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
1=== modified file 'cmd/juju/status.go'
2--- cmd/juju/status.go 2013-07-30 01:31:52 +0000
3+++ cmd/juju/status.go 2013-08-07 09:52:34 +0000
4@@ -74,11 +74,13 @@
5 fmt.Fprintf(ctx.Stderr, "cannot retrieve instances from the environment: %v\n", err)
6 }
7 result := struct {
8- Machines map[string]machineStatus `json:"machines"`
9- Services map[string]serviceStatus `json:"services"`
10+ Environment string `json:"environment"`
11+ Machines map[string]machineStatus `json:"machines"`
12+ Services map[string]serviceStatus `json:"services"`
13 }{
14- Machines: context.processMachines(),
15- Services: context.processServices(),
16+ Environment: conn.Environ.Name(),
17+ Machines: context.processMachines(),
18+ Services: context.processServices(),
19 }
20 return c.out.Write(ctx, result)
21 }
22
23=== modified file 'cmd/juju/status_test.go'
24--- cmd/juju/status_test.go 2013-07-24 16:08:50 +0000
25+++ cmd/juju/status_test.go 2013-08-07 09:52:34 +0000
26@@ -187,8 +187,9 @@
27 expect{
28 "empty state",
29 M{
30- "machines": M{},
31- "services": M{},
32+ "environment": "dummyenv",
33+ "machines": M{},
34+ "services": M{},
35 },
36 },
37
38@@ -196,6 +197,7 @@
39 expect{
40 "simulate juju bootstrap by adding machine/0 to the state",
41 M{
42+ "environment": "dummyenv",
43 "machines": M{
44 "0": M{
45 "instance-id": "pending",
46@@ -210,6 +212,7 @@
47 expect{
48 "simulate the PA starting an instance in response to the state change",
49 M{
50+ "environment": "dummyenv",
51 "machines": M{
52 "0": M{
53 "agent-state": "pending",
54@@ -227,6 +230,7 @@
55 expect{
56 "simulate the MA started and set the machine status",
57 M{
58+ "environment": "dummyenv",
59 "machines": M{
60 "0": machine0,
61 },
62@@ -245,6 +249,7 @@
63 expect{
64 "simulate the MA setting the version",
65 M{
66+ "environment": "dummyenv",
67 "machines": M{
68 "0": M{
69 "dns-name": "dummyenv-0.dns",
70@@ -266,6 +271,7 @@
71 expect{
72 "machine 0 has specific hardware characteristics",
73 M{
74+ "environment": "dummyenv",
75 "machines": M{
76 "0": M{
77 "agent-state": "started",
78@@ -284,6 +290,7 @@
79 expect{
80 "machine 0 reports pending",
81 M{
82+ "environment": "dummyenv",
83 "machines": M{
84 "0": M{
85 "instance-id": "pending",
86@@ -298,6 +305,7 @@
87 expect{
88 "machine 0 reports missing",
89 M{
90+ "environment": "dummyenv",
91 "machines": M{
92 "0": M{
93 "instance-state": "missing",
94@@ -321,6 +329,7 @@
95 expect{
96 "no services exposed yet",
97 M{
98+ "environment": "dummyenv",
99 "machines": M{
100 "0": machine0,
101 },
102@@ -335,6 +344,7 @@
103 expect{
104 "one exposed service",
105 M{
106+ "environment": "dummyenv",
107 "machines": M{
108 "0": machine0,
109 },
110@@ -354,6 +364,7 @@
111 expect{
112 "two more machines added",
113 M{
114+ "environment": "dummyenv",
115 "machines": M{
116 "0": machine0,
117 "1": machine1,
118@@ -380,6 +391,7 @@
119 expect{
120 "add two units, one alive (in error state), one down",
121 M{
122+ "environment": "dummyenv",
123 "machines": M{
124 "0": machine0,
125 "1": machine1,
126@@ -428,6 +440,7 @@
127 expect{
128 "add three more machine, one with a dead agent, one in error state and one dead itself; also one dying unit",
129 M{
130+ "environment": "dummyenv",
131 "machines": M{
132 "0": machine0,
133 "1": machine1,
134@@ -495,6 +508,7 @@
135 expect{
136 "service shows life==dying",
137 M{
138+ "environment": "dummyenv",
139 "machines": M{
140 "0": M{
141 "instance-id": "pending",
142@@ -565,6 +579,7 @@
143 expect{
144 "multiples services with relations between some of them",
145 M{
146+ "environment": "dummyenv",
147 "machines": M{
148 "0": machine0,
149 "1": machine1,
150@@ -658,6 +673,7 @@
151 expect{
152 "multiples related peer units",
153 M{
154+ "environment": "dummyenv",
155 "machines": M{
156 "0": machine0,
157 "1": machine1,
158@@ -734,6 +750,7 @@
159 expect{
160 "multiples related peer units",
161 M{
162+ "environment": "dummyenv",
163 "machines": M{
164 "0": machine0,
165 "1": machine1,
166@@ -822,6 +839,7 @@
167 expect{
168 "machines with nested containers",
169 M{
170+ "environment": "dummyenv",
171 "machines": M{
172 "0": machine0,
173 "1": machine1WithContainers,

Subscribers

People subscribed via source and target branches

to status/vote changes: