Merge lp:~mfoord/juju-core/jenv-warning into lp:~go-bot/juju-core/trunk
- jenv-warning
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Michael Foord |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2388 |
Proposed branch: | lp:~mfoord/juju-core/jenv-warning |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
161 lines (+48/-3) 9 files modified
CONTRIBUTING (+1/-1) agent/mongo/mongo.go (+1/-1) cmd/juju/bootstrap.go (+2/-1) cmd/juju/bootstrap_test.go (+23/-0) environs/configstore/disk.go (+5/-0) environs/configstore/disk_test.go (+1/-0) environs/configstore/interface.go (+4/-0) environs/configstore/mem.go (+5/-0) environs/configstore/mem_test.go (+6/-0) |
To merge this branch: | bzr merge lp:~mfoord/juju-core/jenv-warning |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+209421@code.launchpad.net |
Commit message
cmd/juju: warn user existing jenv file is being used.
Warn the user when bootstrap takes environ config from an existing .jenv file instead of environments.yaml.
Mitigates issue lp:1282642
Description of the change
cmd/juju: warn about existing jenv file
Warn the user when using an existing .jenv file instead of
environments.yaml.
Mitigates issue lp:1282642
Michael Foord (mfoord) wrote : | # |
John A Meinel (jameinel) wrote : | # |
LGTM with a tweak to the message
https:/
File cmd/juju/
https:/
cmd/juju/
.jenv file")
I think this would be easier for users as:
"Using existing environment file: /path/to/
Michael Foord (mfoord) wrote : | # |
Please take a look.
Michael Foord (mfoord) wrote : | # |
Please take a look.
Michael Foord (mfoord) wrote : | # |
Please take a look.
Dimiter Naydenov (dimitern) wrote : | # |
LGTM with two minor suggestions.
https:/
File environs/
https:/
environs/
the environInfo in human readable format
s/format/format./
https:/
File environs/
https:/
environs/
format
s/format/format./ ?
Michael Foord (mfoord) wrote : | # |
Please take a look.
https:/
File environs/
https:/
environs/
the environInfo in human readable format
On 2014/03/06 11:37:24, dimitern wrote:
> s/format/format./
Done.
https:/
File environs/
https:/
environs/
format
On 2014/03/06 11:37:24, dimitern wrote:
> s/format/format./ ?
Done.
Roger Peppe (rogpeppe) wrote : | # |
LGTM with a couple of suggestions below.
https:/
File cmd/juju/
https:/
cmd/juju/
file: %q", loc)
with a slightly shorter variable name, it perhaps seems
more reasonable inline here. Also, given that Location
is documented to be human readable, perhaps we don't
need to quote it.
logger.
?
https:/
File cmd/juju/
https:/
cmd/juju/
gc.Equals, "peckham")
I don't think you need this (and it makes the test slightly more
fragile)
Michael Foord (mfoord) wrote : | # |
On 2014/03/06 12:14:58, rog wrote:
> LGTM with a couple of suggestions below.
https:/
> File cmd/juju/
https:/
> cmd/juju/
file:
> %q", loc)
> with a slightly shorter variable name, it perhaps seems
> more reasonable inline here.
I don't know what this means I'm afraid.
> Also, given that Location
> is documented to be human readable, perhaps we don't
> need to quote it.
> logger.
Well, I don't know that how Location() is *documented* should affect how
we treat it. Either the quotes are helpful or they aren't. For copying
and pasting to the shell they *may* be useful (the location could
contain spaces), so I'm inclined to leave them.
> ?
https:/
> File cmd/juju/
https:/
> cmd/juju/
c.Assert(
> gc.Equals, "peckham")
> I don't think you need this (and it makes the test slightly more
fragile)
We need to read from *one* of the channels returned by runCommand, or
the command isn't actually run. It maybe that just reading the err
channel is enough, in which case this assert is superfluous. I'll check.
Michael Foord (mfoord) wrote : | # |
Please take a look.
Michael Foord (mfoord) wrote : | # |
Please take a look.
William Reade (fwereade) wrote : | # |
a few comments, but not really enough to block it. thoughts though?
https:/
File cmd/juju/
https:/
cmd/juju/
file: %q", loc)
perhaps "ignoring environments.yaml: using bootstrap config in %q"
https:/
File environs/
https:/
environs/
string {
Path()?
https:/
File environs/
https:/
environs/
gc.Matches, ".*/someenv.jenv")
if we know the full path, which we should, I'd really like to assert it
specifically
https:/
File environs/
https:/
environs/
ah. hmm. I see. I think I'd really rather have Path() (string, error);
return ("", ErrNotADiskStore); and handle that error in the command.
overkill?
Wayne Witzel III (wwitzel3) wrote : | # |
On 2014/03/06 15:17:19, fwereade wrote:
> a few comments, but not really enough to block it. thoughts though?
https:/
> File cmd/juju/
https:/
> cmd/juju/
file:
> %q", loc)
> perhaps "ignoring environments.yaml: using bootstrap config in %q"
Updated message to the user and updated Location to return a quoted
string.
https:/
> File environs/
https:/
> environs/
string {
> Path()?
https:/
> File environs/
https:/
> environs/
gc.Matches,
> ".*/someenv.jenv")
> if we know the full path, which we should, I'd really like to assert
it
> specifically
Updated test to use full path.
https:/
> File environs/
https:/
> environs/
> ah. hmm. I see. I think I'd really rather have Path() (string, error);
return
> ("", ErrNotADiskStore); and handle that error in the command.
> overkill?
Michael Foord (mfoord) wrote : | # |
Please take a look.
Wayne Witzel III (wwitzel3) wrote : | # |
On 2014/03/06 15:37:19, fuzzyman wrote:
> Please take a look.
LGMT
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~mfoord/juju-core/jenv-warning into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
-------
PANIC: bootstrap_
... Panic: MgoSuite tests must be run with MgoTestPackage (PC=0x414011)
/usr/lib/
in panic
/home/tarmac/
in MgoSuite.SetUpSuite
bootstrap_
in bootstrapSuite.
OOPS: 24 passed, 1 FIXTURE-PANICKED, 3 MISSED
--- FAIL: Test (0.01 seconds)
FAIL
FAIL launchpad.
ok launchpad.
-------
FAIL: bzr_test.go:26: BzrSuite.SetUpTest
bzr_test.go:28:
c.Assert(
... value *errors.errorString = &errors.
-------
PANIC: bzr_test.go:128: BzrSuite.
... Panic: Fixture has panicked (see related PANIC)
OOPS: 0 passed, 1 FAILED, 8 MISSED
--- FAIL: Test (0.00 seconds)
FAIL
FAIL launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
&{/tmp/
-------
PANIC: deletecharm_
[LOG] 87.28418 INFO juju store: Store opened. Connecting to:
[LOG] 97.85392 ERROR juju store: Error connecting to MongoDB: no reachable servers
[LOG] 97.85401 INFO juju store: Store opened. Connecting to:
[LOG] 8.41398 ERROR juju store: Error connecting to MongoDB: no reachable servers
deletecharm_
c.Assert(err, gc.IsNil)
... value *errors.errorString = &errors.
... Panic: runtime error: invalid memory address or nil pointer dereference (PC=0x413F61)
/usr/lib/
in panic
/usr/lib/
in panicstring
/usr/lib/
in sigpanic
/home/tarmac/
in Store.Close
/usr/lib/
in rundefer
/usr/lib/
in Goexit
/home/tarmac/
in C.stopNow
/home/tarmac/
in C.Assert
deletecharm_
in DeleteCharmSuit
OOPS: 2 passed, 1 PANICKED
--- FAIL: Test (21.13 seconds)
FAIL
FAIL launchpad.
? launchpad.
? launchpad.
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~mfoord/juju-core/jenv-warning into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
-------
PANIC: bootstrap_
[LOG] 97.31167 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 97.31168 DEBUG juju.environs.tools no series specified when finding tools, looking for any
[LOG] 97.31172 DEBUG juju.environs.
[LOG] 97.31175 DEBUG juju.environs.
[LOG] 97.31177 DEBUG juju.environs.
[LOG] 97.31180 DEBUG juju.environs.
[LOG] 97.31241 INFO juju.environs.tools Writing tools/streams/
[LOG] 97.31266 INFO juju.environs.tools Writing tools/streams/
test 0: no tools uploaded, first check has no retries; no matching binary in source; sync fails with no second attempt
[LOG] 97.31308 INFO juju.provider.dummy reset environment
[LOG] 97.31556 INFO juju Reset successfully reset admin password
[LOG] 97.31600 DEBUG juju.environs.
clearing private storage
removing files: []
[LOG] 97.44200 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 97.44202 DEBUG juju.environs.tools no series specified when finding tools, looking for any
[LOG] 97.44205 DEBUG juju.environs.
[LOG] 97.44207 DEBUG juju.environs.
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~mfoord/juju-core/jenv-warning into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
-------
FAIL: bzr_test.go:26: BzrSuite.SetUpTest
bzr_test.go:28:
c.Assert(
... value *errors.errorString = &errors.
-------
PANIC: bzr_test.go:128: BzrSuite.
... Panic: Fixture has panicked (see related PANIC)
OOPS: 0 passed, 1 FAILED, 8 MISSED
--- FAIL: Test (0.00 seconds)
FAIL
FAIL launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
-------
FAIL: bootstrap_
[LOG] 60.02503 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 60.02503 DEBUG juju.environs.tools no series specified when finding tools, looking for any
[LOG] 60.02507 DEBUG juju.environs.
[LOG] 60.02510 DEBUG juju.environs.
[LOG] 60.02512 DEBUG juju.environs.
[LOG] 60.02515 DEBUG juju.environs.
[LOG] 60.02575 INFO juju.environs.tools Writing tools/streams/
[LOG] 60.02592 INFO juju.environs.tools Writing tools/streams/
[LOG] 60.02616 INFO juju.provider.dummy reset environment
[LOG] 60.02827 INFO juju Reset successfully reset admin password
[LOG] 60.02879 DEBUG juju.environs.
clearing private storage
removing files: []
[LOG] 60.14035 DEBUG juju....
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~mfoord/juju-core/jenv-warning into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
-------
FAIL: bootstrap_
[LOG] 48.74008 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 48.74009 DEBUG juju.environs.tools no series specified when finding tools, looking for any
[LOG] 48.74012 DEBUG juju.environs.
[LOG] 48.74016 DEBUG juju.environs.
[LOG] 48.74017 DEBUG juju.environs.
[LOG] 48.74020 DEBUG juju.environs.
[LOG] 48.74074 INFO juju.environs.tools Writing tools/streams/
[LOG] 48.74088 INFO juju.environs.tools Writing tools/streams/
[LOG] 48.74114 INFO juju.provider.dummy reset environment
[LOG] 48.74319 INFO juju Reset successfully reset admin password
[LOG] 48.74369 DEBUG juju.environs.
clearing private storage
removing files: []
[LOG] 48.83331 DEBUG juju.environs ConfigForName found bootstrap config map[string]
Michael Foord (mfoord) wrote : | # |
Please take a look.
Roger Peppe (rogpeppe) wrote : | # |
On 2014/03/07 09:52:30, fuzzyman wrote:
> Please take a look.
still LGTM
Go Bot (go-bot) wrote : | # |
The attempt to merge lp:~mfoord/juju-core/jenv-warning into lp:juju-core failed. Below is the output from the failed tests.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
ok launchpad.
? launchpad.
? launchpad.
-------
FAIL: bootstrap_
[LOG] 3.17739 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
[LOG] 3.17740 DEBUG juju.environs.tools no series specified when finding tools, looking for any
[LOG] 3.17748 DEBUG juju.environs.
[LOG] 3.17752 DEBUG juju.environs.
[LOG] 3.17756 DEBUG juju.environs.
[LOG] 3.17760 DEBUG juju.environs.
[LOG] 3.17845 INFO juju.environs.tools Writing tools/streams/
[LOG] 3.17872 INFO juju.environs.tools Writing tools/streams/
[LOG] 3.17918 INFO juju.provider.dummy reset environment
[LOG] 3.18227 INFO juju Reset successfully reset admin password
[LOG] 3.18332 DEBUG juju.environs.
clearing private storage
removing files: []
[LOG] 3.30682 DEBUG juju.environs ConfigForName found bootstrap config map[string]
Go Bot (go-bot) wrote : | # |
There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.
Preview Diff
1 | === modified file 'CONTRIBUTING' | |||
2 | --- CONTRIBUTING 2014-01-28 04:58:43 +0000 | |||
3 | +++ CONTRIBUTING 2014-03-07 12:02:53 +0000 | |||
4 | @@ -82,7 +82,7 @@ | |||
5 | 82 | 82 | ||
6 | 83 | "labix.org/v2/mgo" | 83 | "labix.org/v2/mgo" |
7 | 84 | gc "launchpad.net/gocheck" | 84 | gc "launchpad.net/gocheck" |
9 | 85 | "github.com/loggo/loggo" | 85 | "github.com/juju/loggo" |
10 | 86 | 86 | ||
11 | 87 | "launchpad.net/juju-core/state" | 87 | "launchpad.net/juju-core/state" |
12 | 88 | "launchpad.net/juju-core/worker" | 88 | "launchpad.net/juju-core/worker" |
13 | 89 | 89 | ||
14 | === modified file 'agent/mongo/mongo.go' | |||
15 | --- agent/mongo/mongo.go 2014-03-06 20:43:44 +0000 | |||
16 | +++ agent/mongo/mongo.go 2014-03-07 12:02:53 +0000 | |||
17 | @@ -7,7 +7,7 @@ | |||
18 | 7 | "path" | 7 | "path" |
19 | 8 | "path/filepath" | 8 | "path/filepath" |
20 | 9 | 9 | ||
22 | 10 | "github.com/loggo/loggo" | 10 | "github.com/juju/loggo" |
23 | 11 | 11 | ||
24 | 12 | "launchpad.net/juju-core/upstart" | 12 | "launchpad.net/juju-core/upstart" |
25 | 13 | "launchpad.net/juju-core/utils" | 13 | "launchpad.net/juju-core/utils" |
26 | 14 | 14 | ||
27 | === modified file 'cmd/juju/bootstrap.go' | |||
28 | --- cmd/juju/bootstrap.go 2014-02-13 03:16:09 +0000 | |||
29 | +++ cmd/juju/bootstrap.go 2014-03-07 12:02:53 +0000 | |||
30 | @@ -113,8 +113,9 @@ | |||
31 | 113 | return err | 113 | return err |
32 | 114 | } | 114 | } |
33 | 115 | var existing bool | 115 | var existing bool |
35 | 116 | if _, err := store.ReadInfo(c.EnvName); !errors.IsNotFoundError(err) { | 116 | if environInfo, err := store.ReadInfo(c.EnvName); !errors.IsNotFoundError(err) { |
36 | 117 | existing = true | 117 | existing = true |
37 | 118 | logger.Warningf("ignoring environments.yaml: using bootstrap config in %s", environInfo.Location()) | ||
38 | 118 | } | 119 | } |
39 | 119 | environ, err := environs.PrepareFromName(c.EnvName, ctx, store) | 120 | environ, err := environs.PrepareFromName(c.EnvName, ctx, store) |
40 | 120 | if err != nil { | 121 | if err != nil { |
41 | 121 | 122 | ||
42 | === modified file 'cmd/juju/bootstrap_test.go' | |||
43 | --- cmd/juju/bootstrap_test.go 2014-02-13 02:46:58 +0000 | |||
44 | +++ cmd/juju/bootstrap_test.go 2014-03-07 12:02:53 +0000 | |||
45 | @@ -8,6 +8,7 @@ | |||
46 | 8 | "fmt" | 8 | "fmt" |
47 | 9 | "strings" | 9 | "strings" |
48 | 10 | 10 | ||
49 | 11 | "github.com/juju/loggo" | ||
50 | 11 | gc "launchpad.net/gocheck" | 12 | gc "launchpad.net/gocheck" |
51 | 12 | 13 | ||
52 | 13 | "launchpad.net/juju-core/cmd" | 14 | "launchpad.net/juju-core/cmd" |
53 | @@ -26,6 +27,7 @@ | |||
54 | 26 | "launchpad.net/juju-core/errors" | 27 | "launchpad.net/juju-core/errors" |
55 | 27 | "launchpad.net/juju-core/provider/dummy" | 28 | "launchpad.net/juju-core/provider/dummy" |
56 | 28 | coretesting "launchpad.net/juju-core/testing" | 29 | coretesting "launchpad.net/juju-core/testing" |
57 | 30 | jc "launchpad.net/juju-core/testing/checkers" | ||
58 | 29 | "launchpad.net/juju-core/testing/testbase" | 31 | "launchpad.net/juju-core/testing/testbase" |
59 | 30 | coretools "launchpad.net/juju-core/tools" | 32 | coretools "launchpad.net/juju-core/tools" |
60 | 31 | "launchpad.net/juju-core/version" | 33 | "launchpad.net/juju-core/version" |
61 | @@ -315,6 +317,27 @@ | |||
62 | 315 | c.Check(coretesting.Stdout(ctx2), gc.Equals, "") | 317 | c.Check(coretesting.Stdout(ctx2), gc.Equals, "") |
63 | 316 | } | 318 | } |
64 | 317 | 319 | ||
65 | 320 | func (s *BootstrapSuite) TestBootstrapJenvWarning(c *gc.C) { | ||
66 | 321 | env, fake := makeEmptyFakeHome(c) | ||
67 | 322 | defer fake.Restore() | ||
68 | 323 | defaultSeriesVersion := version.Current | ||
69 | 324 | defaultSeriesVersion.Series = env.Config().DefaultSeries() | ||
70 | 325 | |||
71 | 326 | store, err := configstore.Default() | ||
72 | 327 | c.Assert(err, gc.IsNil) | ||
73 | 328 | ctx := coretesting.Context(c) | ||
74 | 329 | environs.PrepareFromName("peckham", ctx, store) | ||
75 | 330 | |||
76 | 331 | logger := "jenv.warning.test" | ||
77 | 332 | testWriter := &loggo.TestWriter{} | ||
78 | 333 | loggo.RegisterWriter(logger, testWriter, loggo.WARNING) | ||
79 | 334 | defer loggo.RemoveWriter(logger) | ||
80 | 335 | |||
81 | 336 | _, errc := runCommand(ctx, new(BootstrapCommand), "-e", "peckham") | ||
82 | 337 | c.Assert(<-errc, gc.IsNil) | ||
83 | 338 | c.Assert(testWriter.Log, jc.LogMatches, []string{"ignoring environments.yaml: using bootstrap config in .*"}) | ||
84 | 339 | } | ||
85 | 340 | |||
86 | 318 | func (s *BootstrapSuite) TestInvalidLocalSource(c *gc.C) { | 341 | func (s *BootstrapSuite) TestInvalidLocalSource(c *gc.C) { |
87 | 319 | s.PatchValue(&version.Current.Number, version.MustParse("1.2.0")) | 342 | s.PatchValue(&version.Current.Number, version.MustParse("1.2.0")) |
88 | 320 | env, fake := makeEmptyFakeHome(c) | 343 | env, fake := makeEmptyFakeHome(c) |
89 | 321 | 344 | ||
90 | === modified file 'environs/configstore/disk.go' | |||
91 | --- environs/configstore/disk.go 2014-03-05 19:41:34 +0000 | |||
92 | +++ environs/configstore/disk.go 2014-03-07 12:02:53 +0000 | |||
93 | @@ -159,6 +159,11 @@ | |||
94 | 159 | info.Password = creds.Password | 159 | info.Password = creds.Password |
95 | 160 | } | 160 | } |
96 | 161 | 161 | ||
97 | 162 | // Location returns the location of the environInfo in human readable format. | ||
98 | 163 | func (info *environInfo) Location() string { | ||
99 | 164 | return fmt.Sprintf("file %q", info.path) | ||
100 | 165 | } | ||
101 | 166 | |||
102 | 162 | // Write implements EnvironInfo.Write. | 167 | // Write implements EnvironInfo.Write. |
103 | 163 | func (info *environInfo) Write() error { | 168 | func (info *environInfo) Write() error { |
104 | 164 | data, err := goyaml.Marshal(info) | 169 | data, err := goyaml.Marshal(info) |
105 | 165 | 170 | ||
106 | === modified file 'environs/configstore/disk_test.go' | |||
107 | --- environs/configstore/disk_test.go 2013-10-02 04:06:06 +0000 | |||
108 | +++ environs/configstore/disk_test.go 2014-03-07 12:02:53 +0000 | |||
109 | @@ -110,6 +110,7 @@ | |||
110 | 110 | Addresses: []string{"example.com", "kremvax.ru"}, | 110 | Addresses: []string{"example.com", "kremvax.ru"}, |
111 | 111 | CACert: "first line\nsecond line", | 111 | CACert: "first line\nsecond line", |
112 | 112 | }) | 112 | }) |
113 | 113 | c.Assert(info.Location(), gc.Equals, fmt.Sprintf("file %q", dir+"/environments/someenv.jenv")) | ||
114 | 113 | c.Assert(info.BootstrapConfig(), gc.DeepEquals, map[string]interface{}{ | 114 | c.Assert(info.BootstrapConfig(), gc.DeepEquals, map[string]interface{}{ |
115 | 114 | "secret": "blah", | 115 | "secret": "blah", |
116 | 115 | "arble": "bletch", | 116 | "arble": "bletch", |
117 | 116 | 117 | ||
118 | === modified file 'environs/configstore/interface.go' | |||
119 | --- environs/configstore/interface.go 2013-09-26 09:09:29 +0000 | |||
120 | +++ environs/configstore/interface.go 2014-03-07 12:02:53 +0000 | |||
121 | @@ -74,6 +74,10 @@ | |||
122 | 74 | // associated with the environment. | 74 | // associated with the environment. |
123 | 75 | SetAPICredentials(APICredentials) | 75 | SetAPICredentials(APICredentials) |
124 | 76 | 76 | ||
125 | 77 | // Location returns the location of the source of the environment | ||
126 | 78 | // information in a human readable format. | ||
127 | 79 | Location() string | ||
128 | 80 | |||
129 | 77 | // Write writes the current information to persistent storage. | 81 | // Write writes the current information to persistent storage. |
130 | 78 | // A subsequent call to ConfigStorage.ReadInfo | 82 | // A subsequent call to ConfigStorage.ReadInfo |
131 | 79 | // can retrieve it. After this call succeeds, Initialized will return true. | 83 | // can retrieve it. After this call succeeds, Initialized will return true. |
132 | 80 | 84 | ||
133 | === modified file 'environs/configstore/mem.go' | |||
134 | --- environs/configstore/mem.go 2013-09-25 16:32:36 +0000 | |||
135 | +++ environs/configstore/mem.go 2014-03-07 12:02:53 +0000 | |||
136 | @@ -71,6 +71,11 @@ | |||
137 | 71 | return nil, errors.NotFoundf("environment %q", envName) | 71 | return nil, errors.NotFoundf("environment %q", envName) |
138 | 72 | } | 72 | } |
139 | 73 | 73 | ||
140 | 74 | // Location implements EnvironInfo.Location. | ||
141 | 75 | func (info *memInfo) Location() string { | ||
142 | 76 | return "memory" | ||
143 | 77 | } | ||
144 | 78 | |||
145 | 74 | // Write implements EnvironInfo.Write. | 79 | // Write implements EnvironInfo.Write. |
146 | 75 | func (info *memInfo) Write() error { | 80 | func (info *memInfo) Write() error { |
147 | 76 | m := info.store | 81 | m := info.store |
148 | 77 | 82 | ||
149 | === modified file 'environs/configstore/mem_test.go' | |||
150 | --- environs/configstore/mem_test.go 2013-09-20 10:33:19 +0000 | |||
151 | +++ environs/configstore/mem_test.go 2014-03-07 12:02:53 +0000 | |||
152 | @@ -20,3 +20,9 @@ | |||
153 | 20 | return configstore.NewMem() | 20 | return configstore.NewMem() |
154 | 21 | } | 21 | } |
155 | 22 | } | 22 | } |
156 | 23 | |||
157 | 24 | func (s *memInterfaceSuite) TestMemInfoLocation(c *gc.C) { | ||
158 | 25 | memStore := configstore.NewMem() | ||
159 | 26 | memInfo, _ := memStore.CreateInfo("foo") | ||
160 | 27 | c.Assert(memInfo.Location(), gc.Equals, "memory") | ||
161 | 28 | } |
Reviewers: mp+209421_ code.launchpad. net,
Message:
Please take a look.
Description:
https:/ /code.launchpad .net/~mfoord/ juju-core/ jenv-warning/ +merge/ 209421
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/71490045/
Affected files (+27, -0 lines): bootstrap. go bootstrap_ test.go
A [revision details]
M cmd/juju/
M cmd/juju/
Index: [revision details] 20140227172835- l54f642dgfcocrj 0
=== 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-
+New revision: <email address hidden>
Index: cmd/juju/ bootstrap. go bootstrap. go' bootstrap. go 2014-02-13 03:16:09 +0000 bootstrap. go 2014-03-05 11:00:23 +0000 c.EnvName) ; !errors. IsNotFoundError (err) { Warningf( "Found and using existing .jenv file") PrepareFromName (c.EnvName, ctx, store)
=== modified file 'cmd/juju/
--- cmd/juju/
+++ cmd/juju/
@@ -115,6 +115,7 @@
var existing bool
if _, err := store.ReadInfo(
existing = true
+ logger.
}
environ, err := environs.
if err != nil {
Index: cmd/juju/ bootstrap_ test.go bootstrap_ test.go' bootstrap_ test.go 2014-02-13 02:46:58 +0000 bootstrap_ test.go 2014-03-05 14:45:19 +0000
=== modified file 'cmd/juju/
--- cmd/juju/
+++ cmd/juju/
@@ -8,6 +8,7 @@
"fmt"
"strings"
+ "github. com/loggo/ loggo" net/gocheck"
gc "launchpad.
"launchpad. net/juju- core/cmd" net/juju- core/errors" net/juju- core/provider/ dummy" net/juju- core/testing" net/juju- core/testing/ checkers" net/juju- core/testing/ testbase" net/juju- core/tools" net/juju- core/version" coretesting. Stdout( ctx2), gc.Equals, "")
@@ -26,6 +27,7 @@
"launchpad.
"launchpad.
coretesting "launchpad.
+ jc "launchpad.
"launchpad.
coretools "launchpad.
"launchpad.
@@ -315,6 +317,28 @@
c.Check(
}
+func (s *BootstrapSuite) TestBootstrapJe nvWarning( c *gc.C) { me(c) rsion := version.Current rsion.Series = env.Config( ).DefaultSeries () Default( ) Context( c) PrepareFromName ("peckham" , ctx, store) riter(logger, testWriter, loggo.WARNING) ter(logger) mmand), "-e", "peckham") (<-opc) .(dummy. OpPutFile) .Env, gc.Equals, "peckham") testWriter. Log, jc.LogMatches, []string{"Found and using lSource( c *gc.C) { (&version. Current. Number, version. MustParse( "1.2.0" )) me(c)
+ env, fake := makeEmptyFakeHo
+ defer fake.Restore()
+ defaultSeriesVe
+ defaultSeriesVe
+
+ store, err := configstore.
+ c.Assert(err, gc.IsNil)
+ ctx := coretesting.
+ environs.
+
+ logger := "jenv.warning.test"
+ testWriter := &loggo.TestWriter{}
+ loggo.RegisterW
+ defer loggo.RemoveWri
+
+ opc, errc := runCommand(ctx, new(BootstrapCo
+ c.Assert(<-errc, gc.IsNil)
+ c.Assert(
+ c.Assert(
existing .jenv file"})
+}
+
func (s *BootstrapSuite) TestInvalidLoca
s.PatchValue
env, fake := makeEmptyFakeHo