Merge lp:~michael.nelson/juju-core/1208505-status-env into lp:~go-bot/juju-core/trunk

Proposed by Michael Nelson
Status: Merged
Approved by: Andrew Wilkins
Approved revision: no longer in the source branch.
Merged at revision: 1609
Proposed branch: lp:~michael.nelson/juju-core/1208505-status-env
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 173 lines (+26/-6)
2 files modified
cmd/juju/status.go (+6/-4)
cmd/juju/status_test.go (+20/-2)
To merge this branch: bzr merge lp:~michael.nelson/juju-core/1208505-status-env
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+178766@code.launchpad.net

Commit message

Add 'environment' key to juju status.

Adds an 'environment' key to the output of juju status, as per bug 1208505.

https://codereview.appspot.com/12535043/

R=axwalk, dimitern

Description of the change

Add 'environment' key to juju status.

Adds an 'environment' key to the output of juju status, as per bug 1208505.

https://codereview.appspot.com/12535043/

To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :
Download full text (5.4 KiB)

Reviewers: mp+178766_code.launchpad.net,

Message:
Please take a look.

Description:
Add 'environment' key to juju status.

Adds an 'environment' key to the output of juju status, as per bug
1208505
.
At first I was planning to only include the key iff the -e flag had not
been specified, but seems saner to just always include it.

Hopefully there aren't external packages/tests dependent on the result
having
only machines/services keys - that's the only danger I can think of?

https://code.launchpad.net/~michael.nelson/juju-core/1208505-status-env/+merge/178766

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M cmd/juju/status.go
   M cmd/juju/status_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-20130806125611-y7dvtxkjf6jqgrfx
+New revision: <email address hidden>

Index: cmd/juju/status.go
=== modified file 'cmd/juju/status.go'
--- cmd/juju/status.go 2013-07-30 01:31:52 +0000
+++ cmd/juju/status.go 2013-08-06 14:17:24 +0000
@@ -74,11 +74,13 @@
    fmt.Fprintf(ctx.Stderr, "cannot retrieve instances from the
environment: %v\n", err)
   }
   result := struct {
- Machines map[string]machineStatus `json:"machines"`
- Services map[string]serviceStatus `json:"services"`
+ Environment string `json:"environment"`
+ Machines map[string]machineStatus `json:"machines"`
+ Services map[string]serviceStatus `json:"services"`
   }{
- Machines: context.processMachines(),
- Services: context.processServices(),
+ Environment: conn.Environ.Name(),
+ Machines: context.processMachines(),
+ Services: context.processServices(),
   }
   return c.out.Write(ctx, result)
  }

Index: cmd/juju/status_test.go
=== modified file 'cmd/juju/status_test.go'
--- cmd/juju/status_test.go 2013-07-24 16:08:50 +0000
+++ cmd/juju/status_test.go 2013-08-06 14:17:24 +0000
@@ -187,8 +187,9 @@
    expect{
     "empty state",
     M{
- "machines": M{},
- "services": M{},
+ "environment": "dummyenv",
+ "machines": M{},
+ "services": M{},
     },
    },

@@ -196,6 +197,7 @@
    expect{
     "simulate juju bootstrap by adding machine/0 to the state",
     M{
+ "environment": "dummyenv",
      "machines": M{
       "0": M{
        "instance-id": "pending",
@@ -210,6 +212,7 @@
    expect{
     "simulate the PA starting an instance in response to the state change",
     M{
+ "environment": "dummyenv",
      "machines": M{
       "0": M{
        "agent-state": "pending",
@@ -227,6 +230,7 @@
    expect{
     "simulate the MA started and set the machine status",
     M{
+ "environment": "dummyenv",
      "machines": M{
       "0": machine0,
      },
@@ -245,6 +249,7 @@
    expect{
     "simulate the MA setting the version",
     M{
+ "environment": "dummyenv",
      "machines": M{
       "0": M{
        "dns-name": "dummyenv-0.dns",
@@ -266,6 +271,7 @@
    expect{
     "machine 0 has specific hardware characteristics...

Read more...

Revision history for this message
Andrew Wilkins (axwalk) wrote :

On 2013/08/06 14:36:14, absoludity wrote:
> Please take a look.

LGTM

https://codereview.appspot.com/12535043/

Revision history for this message
Dimiter Naydenov (dimitern) wrote :
Revision history for this message
Go Bot (go-bot) wrote :
Download full text (5.9 KiB)

The attempt to merge lp:~michael.nelson/juju-core/1208505-status-env into lp:juju-core failed. Below is the output from the failed tests.

ok launchpad.net/juju-core/agent 1.718s
ok launchpad.net/juju-core/agent/tools 20.424s
ok launchpad.net/juju-core/bzr 6.304s
ok launchpad.net/juju-core/cert 2.364s
ok launchpad.net/juju-core/charm 0.542s
? launchpad.net/juju-core/charm/hooks [no test files]
ok launchpad.net/juju-core/cloudinit 0.019s
ok launchpad.net/juju-core/cmd 0.218s
? launchpad.net/juju-core/cmd/builddb [no test files]
? 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 103.027s
ok launchpad.net/juju-core/cmd/jujud 51.236s
ok launchpad.net/juju-core/cmd/plugins/juju-metadata 0.812s
ok launchpad.net/juju-core/constraints 0.026s
ok launchpad.net/juju-core/container/lxc 0.315s
? launchpad.net/juju-core/container/lxc/mock [no test files]
ok launchpad.net/juju-core/downloader 5.262s
ok launchpad.net/juju-core/environs 1.250s
? launchpad.net/juju-core/environs/all [no test files]
ok launchpad.net/juju-core/environs/azure 3.545s
ok launchpad.net/juju-core/environs/cloudinit 0.515s
ok launchpad.net/juju-core/environs/config 0.743s
ok launchpad.net/juju-core/environs/dummy 16.244s
ok launchpad.net/juju-core/environs/ec2 182.018s
ok launchpad.net/juju-core/environs/imagemetadata 0.250s
ok launchpad.net/juju-core/environs/instances 0.292s
ok launchpad.net/juju-core/environs/jujutest 0.263s
ok launchpad.net/juju-core/environs/local 1.229s
? launchpad.net/juju-core/environs/local/storage [no test files]
ok launchpad.net/juju-core/environs/localstorage 0.246s
ok launchpad.net/juju-core/environs/maas 2.125s
ok launchpad.net/juju-core/environs/openstack 3.881s
? launchpad.net/juju-core/environs/provider [no test files]
ok launchpad.net/juju-core/environs/sync 0.310s
ok launchpad.net/juju-core/environs/testing 0.016s
? launchpad.net/juju-core/errors [no test files]
ok launchpad.net/juju-core/instance 0.025s
ok launchpad.net/juju-core/juju 11.916s
ok launchpad.net/juju-core/juju/osenv 0.227s
? launchpad.net/juju-core/juju/testing [no test files]
ok launchpad.net/juju-core/log 0.019s
ok launchpad.net/juju-core/log/syslog 0.037s
ok launchpad.net/juju-core/names 0.033s
ok launchpad.net/juju-core/rpc 0.280s
ok launchpad.net/juju-core/rpc/jsoncodec 0.196s
ok launchpad.net/juju-core/schema 0.037s

----------------------------------------------------------------------
FAIL: machine_test.go:558: MachineSuite.TestWatchMachine

[LOG] 95.72981 INFO juju state: opening state; mongo addresses: ["localhost:38714"]; entity ""
[LOG] 95.73443 INFO juju state: connection established
[LOG] 95.75393 INFO juju state: initializing environment
machine_test.go:594:
    testing.NewNotifyWatcherC(c, s.State, w).AssertOneChange()
testing/watcher.go:85:
    c.Fatalf("watcher sent unexpected change: (_, %v)", ok)
... Error: watcher sent unexpected change: (_, true)

OOPS: 309 passed, 1 FAILED
--- FAIL: TestPackage (67.55 seconds)
FAIL
FAIL launchpad.net/juju-core/state 67.856s
? launc...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'cmd/juju/status.go'
--- cmd/juju/status.go 2013-07-30 01:31:52 +0000
+++ cmd/juju/status.go 2013-08-07 09:52:34 +0000
@@ -74,11 +74,13 @@
74 fmt.Fprintf(ctx.Stderr, "cannot retrieve instances from the environment: %v\n", err)74 fmt.Fprintf(ctx.Stderr, "cannot retrieve instances from the environment: %v\n", err)
75 }75 }
76 result := struct {76 result := struct {
77 Machines map[string]machineStatus `json:"machines"`77 Environment string `json:"environment"`
78 Services map[string]serviceStatus `json:"services"`78 Machines map[string]machineStatus `json:"machines"`
79 Services map[string]serviceStatus `json:"services"`
79 }{80 }{
80 Machines: context.processMachines(),81 Environment: conn.Environ.Name(),
81 Services: context.processServices(),82 Machines: context.processMachines(),
83 Services: context.processServices(),
82 }84 }
83 return c.out.Write(ctx, result)85 return c.out.Write(ctx, result)
84}86}
8587
=== modified file 'cmd/juju/status_test.go'
--- cmd/juju/status_test.go 2013-07-24 16:08:50 +0000
+++ cmd/juju/status_test.go 2013-08-07 09:52:34 +0000
@@ -187,8 +187,9 @@
187 expect{187 expect{
188 "empty state",188 "empty state",
189 M{189 M{
190 "machines": M{},190 "environment": "dummyenv",
191 "services": M{},191 "machines": M{},
192 "services": M{},
192 },193 },
193 },194 },
194195
@@ -196,6 +197,7 @@
196 expect{197 expect{
197 "simulate juju bootstrap by adding machine/0 to the state",198 "simulate juju bootstrap by adding machine/0 to the state",
198 M{199 M{
200 "environment": "dummyenv",
199 "machines": M{201 "machines": M{
200 "0": M{202 "0": M{
201 "instance-id": "pending",203 "instance-id": "pending",
@@ -210,6 +212,7 @@
210 expect{212 expect{
211 "simulate the PA starting an instance in response to the state change",213 "simulate the PA starting an instance in response to the state change",
212 M{214 M{
215 "environment": "dummyenv",
213 "machines": M{216 "machines": M{
214 "0": M{217 "0": M{
215 "agent-state": "pending",218 "agent-state": "pending",
@@ -227,6 +230,7 @@
227 expect{230 expect{
228 "simulate the MA started and set the machine status",231 "simulate the MA started and set the machine status",
229 M{232 M{
233 "environment": "dummyenv",
230 "machines": M{234 "machines": M{
231 "0": machine0,235 "0": machine0,
232 },236 },
@@ -245,6 +249,7 @@
245 expect{249 expect{
246 "simulate the MA setting the version",250 "simulate the MA setting the version",
247 M{251 M{
252 "environment": "dummyenv",
248 "machines": M{253 "machines": M{
249 "0": M{254 "0": M{
250 "dns-name": "dummyenv-0.dns",255 "dns-name": "dummyenv-0.dns",
@@ -266,6 +271,7 @@
266 expect{271 expect{
267 "machine 0 has specific hardware characteristics",272 "machine 0 has specific hardware characteristics",
268 M{273 M{
274 "environment": "dummyenv",
269 "machines": M{275 "machines": M{
270 "0": M{276 "0": M{
271 "agent-state": "started",277 "agent-state": "started",
@@ -284,6 +290,7 @@
284 expect{290 expect{
285 "machine 0 reports pending",291 "machine 0 reports pending",
286 M{292 M{
293 "environment": "dummyenv",
287 "machines": M{294 "machines": M{
288 "0": M{295 "0": M{
289 "instance-id": "pending",296 "instance-id": "pending",
@@ -298,6 +305,7 @@
298 expect{305 expect{
299 "machine 0 reports missing",306 "machine 0 reports missing",
300 M{307 M{
308 "environment": "dummyenv",
301 "machines": M{309 "machines": M{
302 "0": M{310 "0": M{
303 "instance-state": "missing",311 "instance-state": "missing",
@@ -321,6 +329,7 @@
321 expect{329 expect{
322 "no services exposed yet",330 "no services exposed yet",
323 M{331 M{
332 "environment": "dummyenv",
324 "machines": M{333 "machines": M{
325 "0": machine0,334 "0": machine0,
326 },335 },
@@ -335,6 +344,7 @@
335 expect{344 expect{
336 "one exposed service",345 "one exposed service",
337 M{346 M{
347 "environment": "dummyenv",
338 "machines": M{348 "machines": M{
339 "0": machine0,349 "0": machine0,
340 },350 },
@@ -354,6 +364,7 @@
354 expect{364 expect{
355 "two more machines added",365 "two more machines added",
356 M{366 M{
367 "environment": "dummyenv",
357 "machines": M{368 "machines": M{
358 "0": machine0,369 "0": machine0,
359 "1": machine1,370 "1": machine1,
@@ -380,6 +391,7 @@
380 expect{391 expect{
381 "add two units, one alive (in error state), one down",392 "add two units, one alive (in error state), one down",
382 M{393 M{
394 "environment": "dummyenv",
383 "machines": M{395 "machines": M{
384 "0": machine0,396 "0": machine0,
385 "1": machine1,397 "1": machine1,
@@ -428,6 +440,7 @@
428 expect{440 expect{
429 "add three more machine, one with a dead agent, one in error state and one dead itself; also one dying unit",441 "add three more machine, one with a dead agent, one in error state and one dead itself; also one dying unit",
430 M{442 M{
443 "environment": "dummyenv",
431 "machines": M{444 "machines": M{
432 "0": machine0,445 "0": machine0,
433 "1": machine1,446 "1": machine1,
@@ -495,6 +508,7 @@
495 expect{508 expect{
496 "service shows life==dying",509 "service shows life==dying",
497 M{510 M{
511 "environment": "dummyenv",
498 "machines": M{512 "machines": M{
499 "0": M{513 "0": M{
500 "instance-id": "pending",514 "instance-id": "pending",
@@ -565,6 +579,7 @@
565 expect{579 expect{
566 "multiples services with relations between some of them",580 "multiples services with relations between some of them",
567 M{581 M{
582 "environment": "dummyenv",
568 "machines": M{583 "machines": M{
569 "0": machine0,584 "0": machine0,
570 "1": machine1,585 "1": machine1,
@@ -658,6 +673,7 @@
658 expect{673 expect{
659 "multiples related peer units",674 "multiples related peer units",
660 M{675 M{
676 "environment": "dummyenv",
661 "machines": M{677 "machines": M{
662 "0": machine0,678 "0": machine0,
663 "1": machine1,679 "1": machine1,
@@ -734,6 +750,7 @@
734 expect{750 expect{
735 "multiples related peer units",751 "multiples related peer units",
736 M{752 M{
753 "environment": "dummyenv",
737 "machines": M{754 "machines": M{
738 "0": machine0,755 "0": machine0,
739 "1": machine1,756 "1": machine1,
@@ -822,6 +839,7 @@
822 expect{839 expect{
823 "machines with nested containers",840 "machines with nested containers",
824 M{841 M{
842 "environment": "dummyenv",
825 "machines": M{843 "machines": M{
826 "0": machine0,844 "0": machine0,
827 "1": machine1WithContainers,845 "1": machine1WithContainers,

Subscribers

People subscribed via source and target branches

to status/vote changes: