Merge lp:~waigani/juju-core/1301353-mongodb-dep into lp:~go-bot/juju-core/trunk

Proposed by Jesse Meek
Status: Merged
Approved by: Jesse Meek
Approved revision: no longer in the source branch.
Merged at revision: 2599
Proposed branch: lp:~waigani/juju-core/1301353-mongodb-dep
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 337 lines (+14/-200)
3 files modified
Makefile (+1/-1)
provider/local/prereqs.go (+10/-104)
provider/local/prereqs_test.go (+3/-95)
To merge this branch: bzr merge lp:~waigani/juju-core/1301353-mongodb-dep
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+214156@code.launchpad.net

Commit message

local provider: check for juju-local

Check only for juju-local in the local
provider as mongodb-server, cpu-checker
and rsyslog-gnutls are all dependencies
of juju-local.

Description of the change

local provider: check for juju-local

Check only for juju-local in the local
provider as mongodb-server, cpu-checker
and rsyslog-gnutls are all dependencies
of juju-local.

https://codereview.appspot.com/84360043/

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

You have gone a bit too far with some of the checks.

We only need to touch the local provider prereqs.

https://codereview.appspot.com/84360043/diff/1/cmd/jujud/upgrade_test.go
File cmd/jujud/upgrade_test.go (right):

https://codereview.appspot.com/84360043/diff/1/cmd/jujud/upgrade_test.go#newcode101
cmd/jujud/upgrade_test.go:101: // juju-local should have been installed.
This is not the right place to change this one.

This test is explicitly checking that rsyslog-gnutls has been installed
due to changes in logging requirements.

https://codereview.appspot.com/84360043/diff/1/container/kvm/initialisation.go
File container/kvm/initialisation.go (right):

https://codereview.appspot.com/84360043/diff/1/container/kvm/initialisation.go#newcode47
container/kvm/initialisation.go:47: const neetToInstallKVMOk = `kvm-ok
is not installed. Please install the juju-local package.
Again, wrong place. kvm-ok is in the cpu-checker package.

https://codereview.appspot.com/84360043/diff/1/environs/cloudinit/cloudinit.go
File environs/cloudinit/cloudinit.go (right):

https://codereview.appspot.com/84360043/diff/1/environs/cloudinit/cloudinit.go#newcode223
environs/cloudinit/cloudinit.go:223: c.AddPackage("juju-local")
This is definitely wrong. Cloud-init is what we install on all the
cloud images.

https://codereview.appspot.com/84360043/diff/1/provider/local/prereqs.go
File provider/local/prereqs.go (right):

https://codereview.appspot.com/84360043/diff/1/provider/local/prereqs.go#newcode60
provider/local/prereqs.go:60: // I'm not sure what the path should be?
We don't need this any more

https://codereview.appspot.com/84360043/diff/1/provider/local/prereqs.go#newcode99
provider/local/prereqs.go:99: return errors.New(installJujuLocalUbuntu)
I'm pretty happy to just have this error returned in all cases.

We can deal with the local provider in other platforms when it happens.

https://codereview.appspot.com/84360043/

Revision history for this message
Jesse Meek (waigani) wrote :
Download full text (4.1 KiB)

Reviewers: mp+214156_code.launchpad.net, thumper,

Message:
Running "go test -gocheck.f TestOpenFailsWithProtectedDirectories" in
provider/local raises the original make dir test fail: Juju should not
be able to create the dirs but can. My permissions are as follows:

ls -la /usr/lib | grep "juju"
drwxr-xr-x 5 root root 4096 Apr 4 17:00 juju
drwxr-xr-x 4 root root 4096 Apr 1 15:33 juju-1.17.7

If the fail is due to my perms, wouldn't this be a test isolation issue?

https://codereview.appspot.com/84360043/diff/1/cmd/jujud/upgrade_test.go
File cmd/jujud/upgrade_test.go (right):

https://codereview.appspot.com/84360043/diff/1/cmd/jujud/upgrade_test.go#newcode101
cmd/jujud/upgrade_test.go:101: // juju-local should have been installed.
On 2014/04/07 03:06:40, thumper wrote:
> This is not the right place to change this one.

> This test is explicitly checking that rsyslog-gnutls has been
installed due to
> changes in logging requirements.

Done.

https://codereview.appspot.com/84360043/diff/1/container/kvm/initialisation.go
File container/kvm/initialisation.go (right):

https://codereview.appspot.com/84360043/diff/1/container/kvm/initialisation.go#newcode47
container/kvm/initialisation.go:47: const neetToInstallKVMOk = `kvm-ok
is not installed. Please install the juju-local package.
On 2014/04/07 03:06:40, thumper wrote:
> Again, wrong place. kvm-ok is in the cpu-checker package.

Done.

https://codereview.appspot.com/84360043/diff/1/environs/cloudinit/cloudinit.go
File environs/cloudinit/cloudinit.go (right):

https://codereview.appspot.com/84360043/diff/1/environs/cloudinit/cloudinit.go#newcode223
environs/cloudinit/cloudinit.go:223: c.AddPackage("juju-local")
On 2014/04/07 03:06:40, thumper wrote:
> This is definitely wrong. Cloud-init is what we install on all the
cloud
> images.

Note to self: I should really take a moment to discuss and understand
what I'm doing before I go and do it.

https://codereview.appspot.com/84360043/diff/1/provider/local/prereqs.go
File provider/local/prereqs.go (right):

https://codereview.appspot.com/84360043/diff/1/provider/local/prereqs.go#newcode60
provider/local/prereqs.go:60: // I'm not sure what the path should be?
On 2014/04/07 03:06:40, thumper wrote:
> We don't need this any more

Done.

https://codereview.appspot.com/84360043/diff/1/provider/local/prereqs.go#newcode99
provider/local/prereqs.go:99: return errors.New(installJujuLocalUbuntu)
On 2014/04/07 03:06:40, thumper wrote:
> I'm pretty happy to just have this error returned in all cases.

> We can deal with the local provider in other platforms when it
happens.

Done.

Description:
Check only for juju-local package

Am I'm on the right track? mongodb-server, cpu-checker and
rsyslog-gnutls
are no longer checked for. Only juju-local is checked.

Branch currently fails with the following: On my local machine I get:

FAIL: environ_test.go:54:
environSuite.TestOpenFailsWithProtectedDirectories

 [LOG] 36.85478 INFO juju.provider.local opening environment "test"
 [LOG] 36.85478 TRACE juju.provider.local creating directory
/usr/lib/juju/storage
 [LOG] 36.85478 TRACE juju.provider.local creating directory
/usr/lib/juju/db
 [LOG] 36....

Read more...

Revision history for this message
Jesse Meek (waigani) wrote :

On 2014/04/07 04:43:27, waigani wrote:
> Running "go test -gocheck.f TestOpenFailsWithProtectedDirectories" in
> provider/local raises the original make dir test fail: Juju should not
be able
> to create the dirs but can. My permissions are as follows:

> ls -la /usr/lib | grep "juju"
> drwxr-xr-x 5 root root 4096 Apr 4 17:00 juju
> drwxr-xr-x 4 root root 4096 Apr 1 15:33 juju-1.17.7

> If the fail is due to my perms, wouldn't this be a test isolation
issue?

https://codereview.appspot.com/84360043/diff/1/cmd/jujud/upgrade_test.go
> File cmd/jujud/upgrade_test.go (right):

https://codereview.appspot.com/84360043/diff/1/cmd/jujud/upgrade_test.go#newcode101
> cmd/jujud/upgrade_test.go:101: // juju-local should have been
installed.
> On 2014/04/07 03:06:40, thumper wrote:
> > This is not the right place to change this one.
> >
> > This test is explicitly checking that rsyslog-gnutls has been
installed due to
> > changes in logging requirements.

> Done.

https://codereview.appspot.com/84360043/diff/1/container/kvm/initialisation.go
> File container/kvm/initialisation.go (right):

https://codereview.appspot.com/84360043/diff/1/container/kvm/initialisation.go#newcode47
> container/kvm/initialisation.go:47: const neetToInstallKVMOk = `kvm-ok
is not
> installed. Please install the juju-local package.
> On 2014/04/07 03:06:40, thumper wrote:
> > Again, wrong place. kvm-ok is in the cpu-checker package.

> Done.

https://codereview.appspot.com/84360043/diff/1/environs/cloudinit/cloudinit.go
> File environs/cloudinit/cloudinit.go (right):

https://codereview.appspot.com/84360043/diff/1/environs/cloudinit/cloudinit.go#newcode223
> environs/cloudinit/cloudinit.go:223: c.AddPackage("juju-local")
> On 2014/04/07 03:06:40, thumper wrote:
> > This is definitely wrong. Cloud-init is what we install on all the
cloud
> > images.

> Note to self: I should really take a moment to discuss and understand
what I'm
> doing before I go and do it.

https://codereview.appspot.com/84360043/diff/1/provider/local/prereqs.go
> File provider/local/prereqs.go (right):

https://codereview.appspot.com/84360043/diff/1/provider/local/prereqs.go#newcode60
> provider/local/prereqs.go:60: // I'm not sure what the path should be?
> On 2014/04/07 03:06:40, thumper wrote:
> > We don't need this any more

> Done.

https://codereview.appspot.com/84360043/diff/1/provider/local/prereqs.go#newcode99
> provider/local/prereqs.go:99: return
errors.New(installJujuLocalUbuntu)
> On 2014/04/07 03:06:40, thumper wrote:
> > I'm pretty happy to just have this error returned in all cases.
> >
> > We can deal with the local provider in other platforms when it
happens.

> Done.

"go test -gocheck.f TestOpenFailsWithProtectedDirectories" also fails on
trunk for me. My guess is that it is my perms. Can you confirm what my
perms should be and is this an isolation issue that should be fixed in
test setup?

https://codereview.appspot.com/84360043/

Revision history for this message
Jesse Meek (waigani) wrote :
Revision history for this message
Jesse Meek (waigani) wrote :
Revision history for this message
Tim Penhey (thumper) wrote :

LGTM with the spelling fixed.

https://codereview.appspot.com/84360043/diff/60001/container/kvm/initialisation.go
File container/kvm/initialisation.go (right):

https://codereview.appspot.com/84360043/diff/60001/container/kvm/initialisation.go#newcode48
container/kvm/initialisation.go:48: sudo apt-get install cpu-ckecker`
You have mis-spelled checker

https://codereview.appspot.com/84360043/

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

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

ok launchpad.net/juju-core 0.014s
ok launchpad.net/juju-core/agent 1.158s
ok launchpad.net/juju-core/agent/mongo 0.323s
ok launchpad.net/juju-core/agent/tools 0.195s
ok launchpad.net/juju-core/bzr 5.295s
ok launchpad.net/juju-core/cert 2.723s
ok launchpad.net/juju-core/charm 0.394s
? 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
ok launchpad.net/juju-core/cloudinit/sshinit 0.767s
ok launchpad.net/juju-core/cmd 0.151s
ok launchpad.net/juju-core/cmd/charm-admin 0.776s
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/envcmd 0.191s
ok launchpad.net/juju-core/cmd/juju 211.976s

----------------------------------------------------------------------
PANIC: agent.go:0: MachineSuite.SetUpTest

[LOG] 75.81627 DEBUG juju.environs.configstore Making /tmp/jctest.k0I/gocheck-8674665223082153551/73/home/ubuntu/.juju/environments
[LOG] 75.88249 INFO juju environs/testing: uploading FAKE tools 1.19.0-precise-amd64
[LOG] 75.88308 INFO juju environs/testing: uploading FAKE tools 1.19.0-precise-amd64
[LOG] 75.89138 INFO juju environs/testing: uploading FAKE tools 1.19.0-precise-amd64
[LOG] 75.89183 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 75.89184 DEBUG juju.environs.tools no series specified when finding tools, looking for any
[LOG] 75.89187 DEBUG juju.environs.simplestreams fetchData failed for "tools/streams/v1/index.sjson": file "tools/streams/v1/index.sjson" not found not found
[LOG] 75.89189 DEBUG juju.environs.simplestreams cannot load index "streams/v1/index.sjson": invalid URL "tools/streams/v1/index.sjson" not found
[LOG] 75.89191 DEBUG juju.environs.simplestreams fetchData failed for "tools/streams/v1/index.json": file "tools/streams/v1/index.json" not found not found
[LOG] 75.89193 DEBUG juju.environs.simplestreams cannot load index "streams/v1/index.json": invalid URL "tools/streams/v1/index.json" not found
[LOG] 75.89213 INFO juju.environs.tools Writing tools/streams/v1/index.json
[LOG] 75.89215 INFO juju.environs.tools Writing tools/streams/v1/com.ubuntu.juju:released:tools.json
[LOG] 75.89219 DEBUG juju.environs.bootstrap environment "dummyenv" supports service/machine networks: true
[LOG] 75.89219 INFO juju.environs.bootstrap bootstrapping environment "dummyenv"
[LOG] 75.89222 DEBUG juju.environs.bootstrap looking for bootstrap tools: series="precise", arch=<nil>, version=1.19.0
[LOG] 75.89223 INFO juju.environs.tools reading tools with major.minor version 1.19
[LOG] 75.89224 INFO juju.environs.tools filtering tools by version: 1.19.0
[LOG] 75.89224 INFO juju.environs.tools filtering tools by series: precise
[LOG] 75.89225 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 75.89228 DEBUG juju.environs.simplestreams fetchData failed for "tools/streams/v1/index.sjson": file "tools/streams/v1/...

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

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

ok launchpad.net/juju-core 0.014s
ok launchpad.net/juju-core/agent 1.243s
ok launchpad.net/juju-core/agent/mongo 1.000s
ok launchpad.net/juju-core/agent/tools 0.212s
ok launchpad.net/juju-core/bzr 5.692s
ok launchpad.net/juju-core/cert 2.448s
ok launchpad.net/juju-core/charm 0.434s
? 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.030s
ok launchpad.net/juju-core/cloudinit/sshinit 0.870s
ok launchpad.net/juju-core/cmd 0.146s
ok launchpad.net/juju-core/cmd/charm-admin 0.723s
? launchpad.net/juju-core/cmd/charmd [no test files]
? launchpad.net/juju-core/cmd/charmload [no test files]
ok launchpad.net/juju-core/cmd/envcmd 0.177s
ok launchpad.net/juju-core/cmd/juju 216.863s
panic: Session already closed

goroutine 1785 [running]:
labix.org/v2/mgo.(*Session).cluster(0xc2004436e0, 0x0)
 /home/tarmac/trees/src/labix.org/v2/mgo/session.go:1037 +0x64
labix.org/v2/mgo.(*Session).acquireSocket(0xc2004436e0, 0xc200000001, 0x0, 0x0, 0x0, ...)
 /home/tarmac/trees/src/labix.org/v2/mgo/session.go:3099 +0x212
labix.org/v2/mgo.(*Query).Iter(0xc200cba0e0, 0x7ff0a37c9e78)
 /home/tarmac/trees/src/labix.org/v2/mgo/session.go:2249 +0x18a
launchpad.net/juju-core/state/watcher.(*Watcher).sync(0xc200962240, 0xc2009e2700, 0x7ff0a37c9f70)
 /home/tarmac/trees/src/launchpad.net/juju-core/state/watcher/watcher.go:350 +0xe8
launchpad.net/juju-core/state/watcher.(*Watcher).loop(0xc200962240, 0x0, 0xc200305060)
 /home/tarmac/trees/src/launchpad.net/juju-core/state/watcher/watcher.go:220 +0x87
launchpad.net/juju-core/state/watcher.funcĀ·001()
 /home/tarmac/trees/src/launchpad.net/juju-core/state/watcher/watcher.go:118 +0x2c
created by launchpad.net/juju-core/state/watcher.New
 /home/tarmac/trees/src/launchpad.net/juju-core/state/watcher/watcher.go:120 +0x100

goroutine 1 [chan receive]:
testing.RunTests(0x109cb88, 0x171b2c0, 0x2, 0x2, 0xe26501, ...)
 /usr/lib/go/src/pkg/testing/testing.go:434 +0x88e
testing.Main(0x109cb88, 0x171b2c0, 0x2, 0x2, 0x1727cc0, ...)
 /usr/lib/go/src/pkg/testing/testing.go:365 +0x8a
main.main()
 launchpad.net/juju-core/cmd/jujud/_test/_testmain.go:45 +0x9a

goroutine 2 [syscall]:

goroutine 4 [syscall]:
os/signal.loop()
 /usr/lib/go/src/pkg/os/signal/signal_unix.go:21 +0x1c
created by os/signal.initĀ·1
 /usr/lib/go/src/pkg/os/signal/signal_unix.go:27 +0x2f

goroutine 6 [chan receive]:
launchpad.net/juju-core/provider/dummy.funcĀ·001()
 /home/tarmac/trees/src/launchpad.net/juju-core/provider/dummy/environs.go:208 +0x3a
created by launchpad.net/juju-core/provider/dummy.initĀ·1
 /home/tarmac/trees/src/launchpad.net/juju-core/provider/dummy/environs.go:210 +0xcf

goroutine 9 [chan receive]:
launchpad.net/gocheck.(*suiteRunner).runTest(0xc20072d150, 0xc2007392a0, 0xc2010535a0)
 /home/tarmac/trees/src/launchpad.net/gocheck/gocheck.go:771 +0x4f
launchpad.net/gocheck.(*suiteRunner).run(0xc20072d150, 0xc20034b600)
 /home/tarmac/trees/src/launchpad.net/gocheck/gocheck.go:584 +0x1c5
launchpad.net/gochec...

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

This failure has affected many recent attempts to land branches? Is
the bot/canonistack ill ?

On Thu, Apr 10, 2014 at 7:32 AM, Go Bot <email address hidden> wrote:
> The proposal to merge lp:~waigani/juju-core/1301353-mongodb-dep into lp:juju-core has been updated.
>
> Status: Approved => Needs review
>
> For more details, see:
> https://code.launchpad.net/~waigani/juju-core/1301353-mongodb-dep/+merge/214156
> --
> https://code.launchpad.net/~waigani/juju-core/1301353-mongodb-dep/+merge/214156
> You are subscribed to branch lp:juju-core.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2014-03-18 01:37:21 +0000
3+++ Makefile 2014-04-09 08:25:59 +0000
4@@ -23,7 +23,7 @@
5 distro-info-data
6 git-core
7 mercurial
8- rsyslog-gnutls
9+ juju-local
10 zip
11 $(GO_C)
12 endef
13
14=== modified file 'provider/local/prereqs.go'
15--- provider/local/prereqs.go 2014-03-17 22:07:47 +0000
16+++ provider/local/prereqs.go 2014-04-09 08:25:59 +0000
17@@ -6,33 +6,19 @@
18 import (
19 "errors"
20 "fmt"
21- "os"
22 "os/exec"
23- "regexp"
24 "runtime"
25
26- "launchpad.net/juju-core/agent/mongo"
27 "launchpad.net/juju-core/container/kvm"
28 "launchpad.net/juju-core/instance"
29 "launchpad.net/juju-core/utils"
30- "launchpad.net/juju-core/version"
31 )
32
33 var notLinuxError = errors.New("The local provider is currently only available for Linux")
34
35-const installMongodUbuntu = "MongoDB server must be installed to enable the local provider:"
36 const aptAddRepositoryJujuStable = `
37 sudo apt-add-repository ppa:juju/stable # required for MongoDB SSL support
38 sudo apt-get update`
39-const aptGetInstallMongodbServer = `
40- sudo apt-get install mongodb-server`
41-
42-const installMongodGeneric = `
43-MongoDB server must be installed to enable the local provider.
44-Please consult your operating system distribution's documentation
45-for instructions on installing the MongoDB server. Juju requires
46-a MongoDB server built with SSL support.
47-`
48
49 const installLxcUbuntu = `
50 Linux Containers (LXC) userspace tools must be
51@@ -40,15 +26,10 @@
52
53 sudo apt-get install lxc`
54
55-const installRsyslogGnutlsUbuntu = `
56-rsyslog-gnutls must be installed to enable the local provider:
57-
58- sudo apt-get install rsyslog-gnutls`
59-
60-const installRsyslogGnutlsGeneric = `
61-rsyslog-gnutls must be installed to enable the local provider.
62-Please consult your operating system distribution's documentation
63-for instructions on installing this package.`
64+const installJujuLocalUbuntu = `
65+juju-local must be installed to enable the local provider:
66+
67+ sudo apt-get install juju-local`
68
69 const installLxcGeneric = `
70 Linux Containers (LXC) userspace tools must be installed to enable the
71@@ -58,9 +39,6 @@
72 const errUnsupportedOS = `Unsupported operating system: %s
73 The local provider is currently only available for Linux`
74
75-// lowestMongoVersion is the lowest version of mongo that juju supports.
76-var lowestMongoVersion = version.Number{Major: 2, Minor: 2, Patch: 4}
77-
78 // lxclsPath is the path to "lxc-ls", an LXC userspace tool
79 // we check the presence of to determine whether the
80 // tools are installed. This is a variable only to support
81@@ -70,18 +48,10 @@
82 // isPackageInstalled is a variable to support testing.
83 var isPackageInstalled = utils.IsPackageInstalled
84
85-// defaultRsyslogGnutlsPath is the default path to the
86-// rsyslog GnuTLS module. This is a variable only to
87-// support unit testing.
88-var defaultRsyslogGnutlsPath = "/usr/lib/rsyslog/lmnsd_gtls.so"
89-
90 // The operating system the process is running in.
91 // This is a variable only to support unit testing.
92 var goos = runtime.GOOS
93
94-// This is the regex for processing the results of mongod --verison
95-var mongoVerRegex = regexp.MustCompile(`db version v(\d+\.\d+\.\d+)`)
96-
97 // VerifyPrerequisites verifies the prerequisites of
98 // the local machine (machine 0) for running the local
99 // provider.
100@@ -89,10 +59,7 @@
101 if goos != "linux" {
102 return fmt.Errorf(errUnsupportedOS, goos)
103 }
104- if err := verifyMongod(); err != nil {
105- return err
106- }
107- if err := verifyRsyslogGnutls(); err != nil {
108+ if err := verifyJujuLocal(); err != nil {
109 return err
110 }
111 switch containerType {
112@@ -104,42 +71,6 @@
113 return fmt.Errorf("Unknown container type specified in the config.")
114 }
115
116-func verifyMongod() error {
117- path, err := mongo.MongodPath()
118- if err != nil {
119- return wrapMongodNotExist(err)
120- }
121-
122- ver, err := mongodVersion(path)
123- if err != nil {
124- return err
125- }
126- if ver.Compare(lowestMongoVersion) < 0 {
127- return fmt.Errorf("installed version of mongod (%v) is not supported by Juju. "+
128- "Juju requires version %v or greater.",
129- ver,
130- lowestMongoVersion)
131- }
132- return nil
133-}
134-
135-func mongodVersion(path string) (version.Number, error) {
136- data, err := utils.RunCommand(path, "--version")
137- if err != nil {
138- return version.Zero, wrapMongodNotExist(err)
139- }
140-
141- return parseVersion(data)
142-}
143-
144-func parseVersion(data string) (version.Number, error) {
145- matches := mongoVerRegex.FindStringSubmatch(data)
146- if len(matches) < 2 {
147- return version.Zero, errors.New("could not parse mongod version")
148- }
149- return version.Parse(matches[1])
150-}
151-
152 func verifyLxc() error {
153 _, err := exec.LookPath(lxclsPath)
154 if err != nil {
155@@ -148,36 +79,11 @@
156 return nil
157 }
158
159-func verifyRsyslogGnutls() error {
160- if isPackageInstalled("rsyslog-gnutls") {
161- return nil
162- }
163- if utils.IsUbuntu() {
164- return errors.New(installRsyslogGnutlsUbuntu)
165- }
166- // Not all Linuxes will distribute the module
167- // in the same way. Check if it's in the default
168- // location too.
169- _, err := os.Stat(defaultRsyslogGnutlsPath)
170- if err == nil {
171- return nil
172- }
173- return fmt.Errorf("%v\n%s", err, installRsyslogGnutlsGeneric)
174-}
175-
176-func wrapMongodNotExist(err error) error {
177- if utils.IsUbuntu() {
178- series := version.Current.Series
179- args := []interface{}{err, installMongodUbuntu}
180- format := "%v\n%s\n%s"
181- if series == "precise" || series == "quantal" {
182- format += "%s"
183- args = append(args, aptAddRepositoryJujuStable)
184- }
185- args = append(args, aptGetInstallMongodbServer)
186- return fmt.Errorf(format, args...)
187- }
188- return fmt.Errorf("%v\n%s", err, installMongodGeneric)
189+func verifyJujuLocal() error {
190+ if isPackageInstalled("juju-local") {
191+ return nil
192+ }
193+ return errors.New(installJujuLocalUbuntu)
194 }
195
196 func wrapLxcNotFound(err error) error {
197
198=== modified file 'provider/local/prereqs_test.go'
199--- provider/local/prereqs_test.go 2014-03-06 20:35:21 +0000
200+++ provider/local/prereqs_test.go 2014-04-09 08:25:59 +0000
201@@ -4,7 +4,6 @@
202 package local
203
204 import (
205- "fmt"
206 "io/ioutil"
207 "os"
208 "path/filepath"
209@@ -15,7 +14,6 @@
210 "launchpad.net/juju-core/instance"
211 "launchpad.net/juju-core/testing/testbase"
212 "launchpad.net/juju-core/utils"
213- "launchpad.net/juju-core/version"
214 )
215
216 type prereqsSuite struct {
217@@ -53,8 +51,6 @@
218
219 s.PatchValue(&mongo.JujuMongodPath, "/somewhere/that/wont/exist")
220
221- s.setMongoVersion(c, lowestMongoVersion.Major, lowestMongoVersion.Minor, lowestMongoVersion.Patch)
222-
223 os.Setenv("JUJUTEST_LSB_RELEASE_ID", "Ubuntu")
224 err := ioutil.WriteFile(filepath.Join(s.tmpdir, "lsb_release"), []byte(lsbrelease), 0777)
225 c.Assert(err, gc.IsNil)
226@@ -80,83 +76,6 @@
227 echo Thu Feb 13 15:53:58.210 git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
228 `
229
230-func (s *prereqsSuite) setMongoVersion(c *gc.C, major, minor, patch int) {
231- script := fmt.Sprintf(fakeMongoFmt, major, minor, patch)
232- err := ioutil.WriteFile(s.testMongodPath, []byte(script), 0777)
233- c.Assert(err, gc.IsNil)
234-}
235-
236-func (s *prereqsSuite) TestParseMongoVersion(c *gc.C) {
237- s.setMongoVersion(c, 2, 2, 2)
238-
239- ver, err := mongodVersion(s.testMongodPath)
240- c.Assert(err, gc.IsNil)
241- c.Assert(ver, gc.Equals, version.Number{2, 2, 2, 0})
242-}
243-
244-func (s *prereqsSuite) TestVerifyMongod(c *gc.C) {
245- lowver := version.Number{2, 2, 2, 0}
246- s.PatchValue(&lowestMongoVersion, lowver)
247-
248- s.setMongoVersion(c, 3, 0, 0)
249- c.Assert(verifyMongod(), gc.IsNil)
250-
251- s.setMongoVersion(c, 2, 3, 0)
252- c.Assert(verifyMongod(), gc.IsNil)
253-
254- s.setMongoVersion(c, 2, 2, 3)
255- c.Assert(verifyMongod(), gc.IsNil)
256-
257- s.setMongoVersion(c, 2, 2, 2)
258- c.Assert(verifyMongod(), gc.IsNil)
259-
260- expected := fmt.Sprintf("installed version of mongod .* is not supported by Juju. "+
261- "Juju requires version %v or greater.", lowver)
262-
263- s.setMongoVersion(c, 2, 2, 1)
264- c.Assert(verifyMongod(), gc.ErrorMatches, expected)
265-
266- s.setMongoVersion(c, 2, 1, 3)
267- c.Assert(verifyMongod(), gc.ErrorMatches, expected)
268-
269- s.setMongoVersion(c, 1, 3, 3)
270- c.Assert(verifyMongod(), gc.ErrorMatches, expected)
271-}
272-
273-func (s *prereqsSuite) TestParseVersion(c *gc.C) {
274- data := `
275-db version v3.2.1
276-Thu Feb 13 15:53:58.210 git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
277-`[1:]
278- v, err := parseVersion(data)
279- c.Assert(err, gc.IsNil)
280- c.Assert(v, gc.Equals, version.Number{3, 2, 1, 0})
281-
282- data = "this is total garbage"
283- v, err = parseVersion(data)
284- c.Assert(err, gc.ErrorMatches, "could not parse mongod version")
285- c.Assert(v, gc.Equals, version.Zero)
286-}
287-
288-func (s *prereqsSuite) TestMongoPrereq(c *gc.C) {
289- err := os.Remove(s.testMongodPath)
290- c.Assert(err, gc.IsNil)
291-
292- err = VerifyPrerequisites(instance.LXC)
293- c.Assert(err, gc.ErrorMatches, "(.|\n)*MongoDB server must be installed(.|\n)*")
294- c.Assert(err, gc.ErrorMatches, "(.|\n)*apt-get install mongodb-server(.|\n)*")
295-
296- os.Setenv("JUJUTEST_LSB_RELEASE_ID", "NotUbuntu")
297- err = VerifyPrerequisites(instance.LXC)
298- c.Assert(err, gc.ErrorMatches, "(.|\n)*MongoDB server must be installed(.|\n)*")
299- c.Assert(err, gc.Not(gc.ErrorMatches), "(.|\n)*apt-get install(.|\n)*")
300-
301- s.PatchValue(&lowestMongoVersion, version.Number{2, 2, 2, 0})
302- s.setMongoVersion(c, 3, 0, 0)
303- err = VerifyPrerequisites(instance.LXC)
304- c.Assert(err, gc.IsNil)
305-}
306-
307 func (s *prereqsSuite) TestLxcPrereq(c *gc.C) {
308 s.PatchValue(&lxclsPath, filepath.Join(s.tmpdir, "non-existent"))
309
310@@ -175,24 +94,13 @@
311 c.Assert(err, gc.IsNil)
312 }
313
314-func (s *prereqsSuite) TestRsyslogGnutlsPrereq(c *gc.C) {
315+func (s *prereqsSuite) TestJujuLocalPrereq(c *gc.C) {
316 err := os.Remove(filepath.Join(s.tmpdir, "dpkg-query"))
317 c.Assert(err, gc.IsNil)
318 err = os.Symlink("/bin/false", filepath.Join(s.tmpdir, "dpkg-query"))
319 c.Assert(err, gc.IsNil)
320
321 err = VerifyPrerequisites(instance.LXC)
322- c.Assert(err, gc.ErrorMatches, "(.|\n)*rsyslog-gnutls must be installed to enable the local provider(.|\n)*")
323- c.Assert(err, gc.ErrorMatches, "(.|\n)*apt-get install rsyslog-gnutls(.|\n)*")
324-
325- s.PatchValue(&defaultRsyslogGnutlsPath, filepath.Join(s.tmpdir, "non-existent"))
326- os.Setenv("JUJUTEST_LSB_RELEASE_ID", "NotUbuntu")
327- err = VerifyPrerequisites(instance.LXC)
328- c.Assert(err, gc.ErrorMatches, "(.|\n)*non-existent: no such file or directory(.|\n)*")
329- c.Assert(err, gc.Not(gc.ErrorMatches), "(.|\n)*apt-get install rsyslog-gnutls(.|\n)*")
330-
331- err = ioutil.WriteFile(defaultRsyslogGnutlsPath, nil, 0644)
332- c.Assert(err, gc.IsNil)
333- err = VerifyPrerequisites(instance.LXC)
334- c.Assert(err, gc.IsNil)
335+ c.Assert(err, gc.ErrorMatches, "(.|\n)*juju-local must be installed to enable the local provider(.|\n)*")
336+ c.Assert(err, gc.ErrorMatches, "(.|\n)*apt-get install juju-local(.|\n)*")
337 }

Subscribers

People subscribed via source and target branches

to status/vote changes: