Merge lp:~thumper/juju-core/juju-mongodb into lp:~go-bot/juju-core/trunk

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2441
Proposed branch: lp:~thumper/juju-core/juju-mongodb
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 243 lines (+104/-27)
4 files modified
agent/mongo/mongo.go (+30/-3)
agent/mongo/mongo_test.go (+2/-1)
environs/cloudinit/cloudinit.go (+24/-17)
environs/cloudinit/cloudinit_test.go (+48/-6)
To merge this branch: bzr merge lp:~thumper/juju-core/juju-mongodb
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+211642@code.launchpad.net

Commit message

Use juju-mongodb on trusty.

This branch does the simplest thing that can work.
For trusty, juju-mongodb is always used, for other
series mongodb-server is used.

This does mean that the local provider on trusty will
now depend on juju-mongodb. James Page is aware, and
will make the dependency required for the juju-local
package when we tell him.

Tested on the local provider on trusty, and ec2 using
precise.

https://codereview.appspot.com/77300044/

Description of the change

Use juju-mongodb on trusty.

This branch does the simplest thing that can work.
For trusty, juju-mongodb is always used, for other
series mongodb-server is used.

This does mean that the local provider on trusty will
now depend on juju-mongodb. James Page is aware, and
will make the dependency required for the juju-local
package when we tell him.

Tested on the local provider on trusty, and ec2 using
precise.

https://codereview.appspot.com/77300044/

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :
Download full text (8.8 KiB)

Reviewers: mp+211642_code.launchpad.net,

Message:
Please take a look.

Description:
Use juju-mongodb on trusty.

This branch does the simplest thing that can work.
For trusty, juju-mongodb is always used, for other
series mongodb-server is used.

This does mean that the local provider on trusty will
now depend on juju-mongodb. James Page is aware, and
will make the dependency required for the juju-local
package when we tell him.

Tested on the local provider on trusty, and ec2 using
precise.

https://code.launchpad.net/~thumper/juju-core/juju-mongodb/+merge/211642

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/77300044/

Affected files (+56, -26 lines):
   A [revision details]
   M agent/mongo/mongo.go
   M agent/mongo/mongo_test.go
   M environs/cloudinit/cloudinit.go
   M environs/cloudinit/cloudinit_test.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20140318032657-od048h1fmr1ocrfd
+New revision: <email address hidden>

Index: agent/mongo/mongo.go
=== modified file 'agent/mongo/mongo.go'
--- agent/mongo/mongo.go 2014-03-07 16:08:14 +0000
+++ agent/mongo/mongo.go 2014-03-18 22:21:00 +0000
@@ -25,8 +25,28 @@

   // JujuMongodPath holds the default path to the juju-specific mongod.
   JujuMongodPath = "/usr/lib/juju/bin/mongod"
+ // MongodbServerPath holds the default path to the generic mongod.
+ MongodbServerPath = "/usr/bin/mongod"
  )

+// MongoPackageForSeries returns the name of the mongo package for the
series
+// of the machine that it is going to be running on.
+func MongoPackageForSeries(series string) string {
+ if series == "trusty" {
+ return "juju-mongodb"
+ }
+ return "mongodb-server"
+}
+
+// MongodPathForSeries returns the path to the mongod executable for the
+// series of the machine that it is going to be running on.
+func MongodPathForSeries(series string) string {
+ if series == "trusty" {
+ return JujuMongodPath
+ }
+ return MongodbServerPath
+}
+
  // MongoPath returns the executable path to be used to run mongod on this
  // machine. If the juju-bundled version of mongo exists, it will return
that
  // path, otherwise it will return the command to run mongod from the path.
@@ -48,8 +68,12 @@
  // This method will remove old versions of the mongo upstart script as
necessary
  // before installing the new version.
  func EnsureMongoServer(dir string, port int) error {
+ // NOTE: ensure that the right package is installed?
   name := makeServiceName(mongoScriptVersion)
- service, err := MongoUpstartService(name, dir, port)
+ // TODO: get the series from somewhere, non trusty values return
+ // the existing default path.
+ mongodPath := MongodPathForSeries("some-series")
+ service, err := MongoUpstartService(name, mongodPath, dir, port)
   if err != nil {
    return err
   }
@@ -132,7 +156,7 @@
  // MongoUpstartService returns the upstart config for the mongo state
service.
  //
  // This method assumes there is a server.pem keyfile in dataDir.
-func MongoUpstartServi...

Read more...

Revision history for this message
Ian Booth (wallyworld) wrote :

LGTM but there's no test for the trusty vs non trusty specific content
of cloud init. I think we need that added.

https://codereview.appspot.com/77300044/diff/1/agent/mongo/mongo.go
File agent/mongo/mongo.go (right):

https://codereview.appspot.com/77300044/diff/1/agent/mongo/mongo.go#newcode75
agent/mongo/mongo.go:75: mongodPath :=
MongodPathForSeries("some-series")
we have version.readSeries()
Why not use that (after the necessary tweaking to expose the
functionality)?

https://codereview.appspot.com/77300044/

Revision history for this message
Go Bot (go-bot) wrote :
Download full text (10.2 KiB)

The attempt to merge lp:~thumper/juju-core/juju-mongodb into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core 0.012s
ok launchpad.net/juju-core/agent 1.027s
ok launchpad.net/juju-core/agent/mongo 0.569s
ok launchpad.net/juju-core/agent/tools 0.180s
ok launchpad.net/juju-core/bzr 5.423s
ok launchpad.net/juju-core/cert 2.767s
ok launchpad.net/juju-core/charm 0.404s
? launchpad.net/juju-core/charm/hooks [no test files]
? launchpad.net/juju-core/charm/testing [no test files]
ok launchpad.net/juju-core/cloudinit 0.025s
ok launchpad.net/juju-core/cloudinit/sshinit 0.884s
ok launchpad.net/juju-core/cmd 0.153s
ok launchpad.net/juju-core/cmd/charm-admin 0.756s
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/juju 192.534s
ok launchpad.net/juju-core/cmd/jujud 68.585s
ok launchpad.net/juju-core/cmd/plugins/juju-metadata 7.463s
? launchpad.net/juju-core/cmd/plugins/juju-restore [no test files]
ok launchpad.net/juju-core/cmd/plugins/local 0.170s
? launchpad.net/juju-core/cmd/plugins/local/juju-local [no test files]
ok launchpad.net/juju-core/constraints 0.037s
ok launchpad.net/juju-core/container 0.063s
ok launchpad.net/juju-core/container/factory 0.051s
ok launchpad.net/juju-core/container/kvm 0.248s
ok launchpad.net/juju-core/container/kvm/mock 0.043s
? launchpad.net/juju-core/container/kvm/testing [no test files]
ok launchpad.net/juju-core/container/lxc 4.309s
? launchpad.net/juju-core/container/lxc/mock [no test files]
? launchpad.net/juju-core/container/lxc/testing [no test files]
? launchpad.net/juju-core/container/testing [no test files]
ok launchpad.net/juju-core/downloader 5.238s
ok launchpad.net/juju-core/environs 2.084s
ok launchpad.net/juju-core/environs/bootstrap 3.143s
ok launchpad.net/juju-core/environs/cloudinit 0.528s
ok launchpad.net/juju-core/environs/config 1.872s
ok launchpad.net/juju-core/environs/configstore 0.037s
ok launchpad.net/juju-core/environs/filestorage 0.027s
ok launchpad.net/juju-core/environs/httpstorage 0.699s
ok launchpad.net/juju-core/environs/imagemetadata 0.476s
? launchpad.net/juju-core/environs/imagemetadata/testing [no test files]
ok launchpad.net/juju-core/environs/instances 0.045s
ok launchpad.net/juju-core/environs/jujutest 0.219s
ok launchpad.net/juju-core/environs/manual 11.305s
ok launchpad.net/juju-core/environs/simplestreams 0.231s
? launchpad.net/juju-core/environs/simplestreams/testing [no test files]
ok launchpad.net/juju-core/environs/sshstorage 0.902s
ok launchpad.net/juju-core/environs/storage 0.815s
ok launchpad.net/juju-core/environs/sync 43.507s
ok launchpad.net/juju-core/environs/testing 0.161s
ok launchpad.net/juju-core/environs/tools 4.521s
? launchpad.net/juju-core/environs/tools/testing [no test files]
ok launchpad.net/juju-core/errors 0.011s
ok launchpad.net/juju-core/instance 0.023s
? launchpad.net/juju-core/instance/testing [no test files]
ok launchpad.net/juju-core/juju 19.559s
ok launchpad.net/juju-core/juju/arch 0.024s
ok laun...

Revision history for this message
Dave Cheney (dave-cheney) wrote :

LGTM with one minor comment

https://codereview.appspot.com/77300044/diff/1/agent/mongo/mongo.go
File agent/mongo/mongo.go (right):

https://codereview.appspot.com/77300044/diff/1/agent/mongo/mongo.go#newcode35
agent/mongo/mongo.go:35: if series == "trusty" {
I don't like the idea that we have to remember to update this in 7
months.

How about

switch series {
case "precise", "raring", "saucy":
     return "mongodb-server"
default:
     // trusty and onwards
     return :juju-mongodb"
}

https://codereview.appspot.com/77300044/diff/1/agent/mongo/mongo.go#newcode47
agent/mongo/mongo.go:47: return MongodbServerPath
same as above

https://codereview.appspot.com/77300044/

Revision history for this message
Go Bot (go-bot) wrote :
Download full text (26.0 KiB)

The attempt to merge lp:~thumper/juju-core/juju-mongodb into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core 0.012s
ok launchpad.net/juju-core/agent 1.073s
ok launchpad.net/juju-core/agent/mongo 0.511s
ok launchpad.net/juju-core/agent/tools 0.203s
ok launchpad.net/juju-core/bzr 5.439s
ok launchpad.net/juju-core/cert 2.615s
ok launchpad.net/juju-core/charm 0.407s
? launchpad.net/juju-core/charm/hooks [no test files]
? launchpad.net/juju-core/charm/testing [no test files]
ok launchpad.net/juju-core/cloudinit 0.029s

----------------------------------------------------------------------
FAIL: configure_test.go:88: configureSuite.TestAptSources

configure_test.go:126:
    c.Assert(
        script,
        checkIff(gc.Matches, needsJujuPPA),
        "(.|\n)*add-apt-repository.*ppa:juju/stable(.|\n)*",
    )
... value string = "" +
... "#!/bin/bash\n" +
... "set -e\n" +
... "test -e /proc/self/fd/9 || exec 9>&2\n" +
... "(\n" +
... "export DEBIAN_FRONTEND=noninteractive\n" +
... "echo 'Running apt-get update' >&9\n" +
... "apt-get --option Dpkg::Options::=--force-confold --assume-yes update\n" +
... "echo 'Running apt-get upgrade' >&9\n" +
... "apt-get --option Dpkg::Options::=--force-confold --assume-yes upgrade\n" +
... "echo 'Installing package: git' >&9\n" +
... "apt-get --option Dpkg::Options::=--force-confold --assume-yes install 'git'\n" +
... "echo 'Installing package: cpu-checker' >&9\n" +
... "apt-get --option Dpkg::Options::=--force-confold --assume-yes install 'cpu-checker'\n" +
... "echo 'Installing package: bridge-utils' >&9\n" +
... "apt-get --option Dpkg::Options::=--force-confold --assume-yes install 'bridge-utils'\n" +
... "echo 'Installing package: rsyslog-gnutls' >&9\n" +
... "apt-get --option Dpkg::Options::=--force-confold --assume-yes install 'rsyslog-gnutls'\n" +
... "echo 'Installing package: juju-mongodb' >&9\n" +
... "apt-get --option Dpkg::Options::=--force-confold --assume-yes install 'juju-mongodb'\n" +
... "set -xe\n" +
... "install -D -m 644 /dev/null '/var/lib/juju/nonce.txt'\n" +
... "printf '%s\\n' 'user-admin:bootstrap' > '/var/lib/juju/nonce.txt'\n" +
... "test -e /proc/self/fd/9 || exec 9>&2\n" +
... "([ ! -e /home/ubuntu/.profile ] || grep -q '.juju-proxy' /home/ubuntu/.profile) || printf '\\n# Added by juju\\n[ -f \"$HOME/.juju-proxy\" ] && . \"$HOME/.juju-proxy\"\\n' >> /home/ubuntu/.profile\n" +
... "mkdir -p /var/lib/juju/locks\n" +
... "[ -e /home/ubuntu ] && chown ubuntu:ubuntu /var/lib/juju/locks\n" +
... "mkdir -p /var/log/juju\n" +
... "bin='/var/lib/juju/tools/1.16.0-quantal-amd64'\n" +
... "mkdir -p $bin\n" +
... "cp '/var/lib/juju/storage/tools/releases/juju-1.16.0-quantal-amd64.tgz' $bin/tools.tar.gz\n" +
... "sha256sum $bin/tools.tar.gz > $bin/juju1.16.0-quantal-amd64.sha256\n" +
... "grep '' $bin/juju1.16.0-quantal-amd64.sha256 || (echo \"Tools checksum mismatch\"; exit 1)\n" +
... "tar zxf $bin/tools.tar.gz -C $bin\n" +
... "rm $bin/tools.tar.gz && rm $bin/juju1.16.0-quantal-amd64.sha256\n" +
......

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'agent/mongo/mongo.go'
2--- agent/mongo/mongo.go 2014-03-07 16:08:14 +0000
3+++ agent/mongo/mongo.go 2014-03-19 04:09:07 +0000
4@@ -25,8 +25,31 @@
5
6 // JujuMongodPath holds the default path to the juju-specific mongod.
7 JujuMongodPath = "/usr/lib/juju/bin/mongod"
8+ // MongodbServerPath holds the default path to the generic mongod.
9+ MongodbServerPath = "/usr/bin/mongod"
10 )
11
12+// MongoPackageForSeries returns the name of the mongo package for the series
13+// of the machine that it is going to be running on.
14+func MongoPackageForSeries(series string) string {
15+ switch series {
16+ case "precise", "quantal", "raring", "saucy":
17+ return "mongodb-server"
18+ default:
19+ // trusty and onwards
20+ return "juju-mongodb"
21+ }
22+}
23+
24+// MongodPathForSeries returns the path to the mongod executable for the
25+// series of the machine that it is going to be running on.
26+func MongodPathForSeries(series string) string {
27+ if series == "trusty" {
28+ return JujuMongodPath
29+ }
30+ return MongodbServerPath
31+}
32+
33 // MongoPath returns the executable path to be used to run mongod on this
34 // machine. If the juju-bundled version of mongo exists, it will return that
35 // path, otherwise it will return the command to run mongod from the path.
36@@ -48,8 +71,12 @@
37 // This method will remove old versions of the mongo upstart script as necessary
38 // before installing the new version.
39 func EnsureMongoServer(dir string, port int) error {
40+ // NOTE: ensure that the right package is installed?
41 name := makeServiceName(mongoScriptVersion)
42- service, err := MongoUpstartService(name, dir, port)
43+ // TODO: get the series from somewhere, non trusty values return
44+ // the existing default path.
45+ mongodPath := MongodPathForSeries("some-series")
46+ service, err := MongoUpstartService(name, mongodPath, dir, port)
47 if err != nil {
48 return err
49 }
50@@ -132,7 +159,7 @@
51 // MongoUpstartService returns the upstart config for the mongo state service.
52 //
53 // This method assumes there is a server.pem keyfile in dataDir.
54-func MongoUpstartService(name, dataDir string, port int) (*upstart.Conf, error) {
55+func MongoUpstartService(name, mongodExec, dataDir string, port int) (*upstart.Conf, error) {
56
57 keyFile := path.Join(dataDir, "server.pem")
58 svc := upstart.NewService(name)
59@@ -146,7 +173,7 @@
60 "nofile": fmt.Sprintf("%d %d", maxFiles, maxFiles),
61 "nproc": fmt.Sprintf("%d %d", maxProcs, maxProcs),
62 },
63- Cmd: "/usr/bin/mongod" +
64+ Cmd: mongodExec +
65 " --auth" +
66 " --dbpath=" + dbDir +
67 " --sslOnNormalPorts" +
68
69=== modified file 'agent/mongo/mongo_test.go'
70--- agent/mongo/mongo_test.go 2014-03-13 07:54:56 +0000
71+++ agent/mongo/mongo_test.go 2014-03-19 04:09:07 +0000
72@@ -120,7 +120,8 @@
73
74 err := EnsureMongoServer(dir, port)
75 c.Assert(err, gc.IsNil)
76- svc, err := MongoUpstartService(makeServiceName(mongoScriptVersion), dir, port)
77+ mongodPath := MongodPathForSeries("some-series")
78+ svc, err := MongoUpstartService(makeServiceName(mongoScriptVersion), mongodPath, dir, port)
79 c.Assert(err, gc.IsNil)
80 defer svc.Remove()
81
82
83=== modified file 'environs/cloudinit/cloudinit.go'
84--- environs/cloudinit/cloudinit.go 2014-03-17 08:25:06 +0000
85+++ environs/cloudinit/cloudinit.go 2014-03-19 04:09:07 +0000
86@@ -346,25 +346,31 @@
87 identityFile := cfg.dataFile(SystemIdentity)
88 c.AddFile(identityFile, cfg.SystemPrivateSSHKey, 0600)
89 if !cfg.DisablePackageCommands {
90- // Disable the default mongodb installed by the mongodb-server package.
91- // Only do this if the file doesn't exist already, so users can run
92- // their own mongodb server if they wish to.
93- c.AddBootCmd(
94- `[ -f /etc/default/mongodb ] ||
95+ series := cfg.Tools.Version.Series
96+ mongoPackage := mongo.MongoPackageForSeries(series)
97+ if mongoPackage == "mongodb-server" {
98+ // Disable the default mongodb installed by the mongodb-server package.
99+ // Only do this if the file doesn't exist already, so users can run
100+ // their own mongodb server if they wish to.
101+ c.AddBootCmd(
102+ `[ -f /etc/default/mongodb ] ||
103 (echo ENABLE_MONGODB="no" > /etc/default/mongodb)`)
104
105- if cfg.NeedMongoPPA() {
106- const key = "" // key is loaded from PPA
107- c.AddAptSource("ppa:juju/stable", key, nil)
108- }
109- if cfg.Tools.Version.Series == "precise" {
110- // In precise we add the cloud-tools pocket and
111- // pin it with a lower priority, so we need to
112- // explicitly specify the target release when
113- // installing mongodb-server from there.
114- c.AddPackageFromTargetRelease("mongodb-server", "precise-updates/cloud-tools")
115+ if cfg.NeedMongoPPA() {
116+ const key = "" // key is loaded from PPA
117+ c.AddAptSource("ppa:juju/stable", key, nil)
118+ }
119+ if series == "precise" {
120+ // In precise we add the cloud-tools pocket and
121+ // pin it with a lower priority, so we need to
122+ // explicitly specify the target release when
123+ // installing mongodb-server from there.
124+ c.AddPackageFromTargetRelease("mongodb-server", "precise-updates/cloud-tools")
125+ } else {
126+ c.AddPackage("mongodb-server")
127+ }
128 } else {
129- c.AddPackage("mongodb-server")
130+ c.AddPackage(mongoPackage)
131 }
132 }
133 certKey := string(cfg.StateServerCert) + string(cfg.StateServerKey)
134@@ -492,7 +498,8 @@
135 )
136
137 name := cfg.MongoServiceName
138- conf, err := mongo.MongoUpstartService(name, cfg.DataDir, cfg.StatePort)
139+ mongodExec := mongo.MongodPathForSeries(cfg.Tools.Version.Series)
140+ conf, err := mongo.MongoUpstartService(name, mongodExec, cfg.DataDir, cfg.StatePort)
141 if err != nil {
142 return err
143 }
144
145=== modified file 'environs/cloudinit/cloudinit_test.go'
146--- environs/cloudinit/cloudinit_test.go 2014-03-13 20:52:41 +0000
147+++ environs/cloudinit/cloudinit_test.go 2014-03-19 04:09:07 +0000
148@@ -13,7 +13,6 @@
149 "launchpad.net/goyaml"
150
151 "launchpad.net/juju-core/agent"
152- "launchpad.net/juju-core/agent/mongo"
153 coreCloudinit "launchpad.net/juju-core/cloudinit"
154 "launchpad.net/juju-core/constraints"
155 "launchpad.net/juju-core/environs"
156@@ -72,9 +71,6 @@
157 return s
158 }
159
160-// mongodPath is the path where we should expect mongod in the environment.
161-var mongodPath = must(mongo.MongodPath())
162-
163 // Each test gives a cloudinit config - we check the
164 // output to see if it looks correct.
165 var cloudinitTests = []cloudinitTest{
166@@ -145,7 +141,7 @@
167 dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc\.1
168 dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc\.2
169 echo 'Starting MongoDB server \(juju-db\)'.*
170-cat >> /etc/init/juju-db\.conf << 'EOF'\\ndescription "juju state database"\\nauthor "Juju Team <juju@lists\.ubuntu\.com>"\\nstart on runlevel \[2345\]\\nstop on runlevel \[!2345\]\\nrespawn\\nnormal exit 0\\n\\nlimit nofile 65000 65000\\nlimit nproc 20000 20000\\n\\nexec ` + mongodPath + ` --auth --dbpath=/var/lib/juju/db --sslOnNormalPorts --sslPEMKeyFile '/var/lib/juju/server\.pem' --sslPEMKeyPassword ignored --bind_ip 0\.0\.0\.0 --port 37017 --noprealloc --syslog --smallfiles\\nEOF\\n
171+cat >> /etc/init/juju-db\.conf << 'EOF'\\ndescription "juju state database"\\nauthor "Juju Team <juju@lists\.ubuntu\.com>"\\nstart on runlevel \[2345\]\\nstop on runlevel \[!2345\]\\nrespawn\\nnormal exit 0\\n\\nlimit nofile 65000 65000\\nlimit nproc 20000 20000\\n\\nexec /usr/bin/mongod --auth --dbpath=/var/lib/juju/db --sslOnNormalPorts --sslPEMKeyFile '/var/lib/juju/server\.pem' --sslPEMKeyPassword ignored --bind_ip 0\.0\.0\.0 --port 37017 --noprealloc --syslog --smallfiles\\nEOF\\n
172 start juju-db
173 mkdir -p '/var/lib/juju/agents/bootstrap'
174 install -m 600 /dev/null '/var/lib/juju/agents/bootstrap/agent\.conf'
175@@ -205,6 +201,44 @@
176 ln -s 1\.2\.3-raring-amd64 '/var/lib/juju/tools/machine-0'
177 `,
178 }, {
179+ // trusty state server - use the new mongo from juju-mongodb
180+ cfg: cloudinit.MachineConfig{
181+ MachineId: "0",
182+ AuthorizedKeys: "sshkey1",
183+ AgentEnvironment: map[string]string{agent.ProviderType: "dummy"},
184+ // raring provides mongo in the archive
185+ Tools: newSimpleTools("1.2.3-trusty-amd64"),
186+ StateServer: true,
187+ StateServerCert: serverCert,
188+ StateServerKey: serverKey,
189+ StatePort: 37017,
190+ APIPort: 17070,
191+ MachineNonce: "FAKE_NONCE",
192+ StateInfo: &state.Info{
193+ Password: "arble",
194+ CACert: []byte("CA CERT\n" + testing.CACert),
195+ },
196+ APIInfo: &api.Info{
197+ Password: "bletch",
198+ CACert: []byte("CA CERT\n" + testing.CACert),
199+ },
200+ Constraints: envConstraints,
201+ DataDir: environs.DataDir,
202+ LogDir: agent.DefaultLogDir,
203+ Jobs: allMachineJobs,
204+ CloudInitOutputLog: environs.CloudInitOutputLog,
205+ StateInfoURL: "some-url",
206+ SystemPrivateSSHKey: "private rsa key",
207+ MachineAgentServiceName: "jujud-machine-0",
208+ MongoServiceName: "juju-db",
209+ },
210+ setEnvConfig: true,
211+ inexactMatch: true,
212+ expectScripts: `
213+echo 'Starting MongoDB server \(juju-db\)'.*
214+cat >> /etc/init/juju-db\.conf << 'EOF'\\ndescription "juju state database"\\nauthor "Juju Team <juju@lists\.ubuntu\.com>"\\nstart on runlevel \[2345\]\\nstop on runlevel \[!2345\]\\nrespawn\\nnormal exit 0\\n\\nlimit nofile 65000 65000\\nlimit nproc 20000 20000\\n\\nexec /usr/lib/juju/bin/mongod --auth --dbpath=/var/lib/juju/db --sslOnNormalPorts --sslPEMKeyFile '/var/lib/juju/server\.pem' --sslPEMKeyPassword ignored --bind_ip 0\.0\.0\.0 --port 37017 --noprealloc --syslog --smallfiles\\nEOF\\n
215+`,
216+ }, {
217 // non state server.
218 cfg: cloudinit.MachineConfig{
219 MachineId: "99",
220@@ -418,6 +452,12 @@
221 // TestCloudInit checks that the output from the various tests
222 // in cloudinitTests is well formed.
223 func (*cloudinitSuite) TestCloudInit(c *gc.C) {
224+ expectedMongoPackage := map[string]string{
225+ "precise": "mongodb-server",
226+ "raring": "mongodb-server",
227+ "trusty": "juju-mongodb",
228+ }
229+
230 for i, test := range cloudinitTests {
231 c.Logf("test %d", i)
232 if test.setEnvConfig {
233@@ -451,7 +491,9 @@
234 acfg := getAgentConfig(c, tag, scripts)
235 c.Assert(acfg, jc.Contains, "AGENT_SERVICE_NAME: jujud-"+tag)
236 if test.cfg.StateServer {
237- checkPackage(c, x, "mongodb-server", true)
238+ series := test.cfg.Tools.Version.Series
239+ mongoPackage := expectedMongoPackage[series]
240+ checkPackage(c, x, mongoPackage, true)
241 source := "ppa:juju/stable"
242 checkAptSource(c, x, source, "", test.cfg.NeedMongoPPA())
243 c.Assert(acfg, jc.Contains, "MONGO_SERVICE_NAME: juju-db")

Subscribers

People subscribed via source and target branches

to status/vote changes: