Merge lp:~waigani/juju-core/cmd_help_aliases_1299120 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: 2717
Proposed branch: lp:~waigani/juju-core/cmd_help_aliases_1299120
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 499 lines (+98/-91)
10 files modified
cmd/juju/cmd_test.go (+5/-5)
cmd/juju/main.go (+4/-4)
cmd/juju/removemachine.go (+19/-12)
cmd/juju/removemachine_test.go (+18/-18)
cmd/juju/removerelation.go (+8/-8)
cmd/juju/removerelation_test.go (+9/-9)
cmd/juju/removeservice.go (+9/-9)
cmd/juju/removeservice_test.go (+12/-12)
cmd/juju/removeunit.go (+8/-8)
cmd/juju/removeunit_test.go (+6/-6)
To merge this branch: bzr merge lp:~waigani/juju-core/cmd_help_aliases_1299120
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+218728@code.launchpad.net

Commit message

Fix 1299120 command aliases

Fix bug 1299120 by ensuring that the
preferred command is not displayed as
an alias of another command in juju
help commands.

Change file and function names to
be consistant with the preferred
command.

https://codereview.appspot.com/92080046/

R=fwereade

Description of the change

Fix 1299120 command aliases

Fix bug 1299120 by ensuring that the
preferred command is not displayed as
an alias of another command in juju
help commands.

Change file and function names to
be consistant with the preferred
command.

https://codereview.appspot.com/92080046/

To post a comment you must log in.
Revision history for this message
Jesse Meek (waigani) wrote :

Reviewers: mp+218728_code.launchpad.net,

Message:
Please take a look.

Description:
Fix 1299120 command aliases

Fix bug 1299120 by ensuring that the
preferred command is not displayed as
an alias of another command in juju
help commands.

Change file and function names to
be consistant with the preferred
command.

https://code.launchpad.net/~waigani/juju-core/cmd_help_aliases_1299120/+merge/218728

(do not edit description out of merge proposal)

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

Affected files (+149, -140 lines):
   A [revision details]
   M cmd/juju/cmd_test.go
   M cmd/juju/main.go
   M cmd/juju/removemachine.go
   M cmd/juju/removemachine_test.go
   M cmd/juju/removerelation.go
   M cmd/juju/removerelation_test.go
   M cmd/juju/removeservice.go
   M cmd/juju/removeservice_test.go
   M cmd/juju/removeunit.go
   M cmd/juju/removeunit_test.go
   M environs/manual/provisioner.go
   M state/api/client.go
   M state/api/params/params.go
   M state/apiserver/client/client.go
   M state/apiserver/client/client_test.go
   M state/apiserver/client/perm_test.go
   M state/minimumunits_test.go
   M state/relation_test.go
   M state/relationunit_test.go
   M state/unit_test.go

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

This breaks compatibility in some places, and we can't do that. The
changes in cmd/juju are fine, but anything that changes what we send
over the wire for the API is not.

https://codereview.appspot.com/92080046/diff/20001/cmd/juju/removemachine.go
File cmd/juju/removemachine.go (right):

https://codereview.appspot.com/92080046/diff/20001/cmd/juju/removemachine.go#newcode77
cmd/juju/removemachine.go:77: return
apiclient.ForceReplaceMachines(c.MachineIds...)
Replace?

https://codereview.appspot.com/92080046/diff/20001/state/api/client.go
File state/api/client.go (left):

https://codereview.appspot.com/92080046/diff/20001/state/api/client.go#oldcode378
state/api/client.go:378: // ServiceDestroy destroys a given service.
What about service? Did we keep "destroy" for service but "remove"
everything else? that seems somewhat incoherent to me.

https://codereview.appspot.com/92080046/diff/20001/state/api/client.go
File state/api/client.go (right):

https://codereview.appspot.com/92080046/diff/20001/state/api/client.go#newcode274
state/api/client.go:274: func (c *Client) ReplaceMachines(machines
...string) error {
This Replace is surprising to me. Just a typo, or something deeper I
haven't figured out?

https://codereview.appspot.com/92080046/diff/20001/state/api/client.go#newcode375
state/api/client.go:375: return c.call("RemoveServiceUnits", params,
nil)
We definitely can't change the stuff we call() -- we need to keep
working with old servers.

https://codereview.appspot.com/92080046/diff/20001/state/api/params/params.go
File state/api/params/params.go (right):

https://codereview.appspot.com/92080046/diff/20001/state/api/params/params.go#newcode285
state/api/params/params.go:285: type RemoveServiceUnits struct {
Yeah, please just don't touch the API at all. We can use the better
names with new api versions -- when we get versioning -- but for now
this is just a break.

(ok, *this* is not -- the names of the types aren't reflected in what we
sent over the wire)

https://codereview.appspot.com/92080046/diff/20001/state/apiserver/client/client.go
File state/apiserver/client/client.go (right):

https://codereview.appspot.com/92080046/diff/20001/state/apiserver/client/client.go#newcode490
state/apiserver/client/client.go:490: func (c *Client)
RemoveServiceUnits(args params.RemoveServiceUnits) error {
...but *this* is a break.

https://codereview.appspot.com/92080046/

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

LGTM, but please do the type/var renames for RemoveMachine as well

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/main.go
File cmd/juju/main.go (left):

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/main.go#oldcode83
cmd/juju/main.go:83: jujucmd.Register(wrap(&DestroyMachineCommand{}))
Shouldn't we RemoveMachine as well? if not, why not? :)

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/removemachine.go
File cmd/juju/removemachine.go (left):

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/removemachine.go#oldcode24
cmd/juju/removemachine.go:24: const destroyMachineDoc = `
removeMachineDoc

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/removemachine.go#oldcode31
cmd/juju/removemachine.go:31: func (c *DestroyMachineCommand) Info()
*cmd.Info {
RemoveMachineCommand

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/removemachine.go
File cmd/juju/removemachine.go (right):

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/removemachine.go#newcode34
cmd/juju/removemachine.go:34: # Remove machine 6, running units or
containers
Remove machine 6, and all its units and containers?

https://codereview.appspot.com/92080046/

Revision history for this message
John A Meinel (jameinel) wrote :

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/main.go
File cmd/juju/main.go (left):

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/main.go#oldcode83
cmd/juju/main.go:83: jujucmd.Register(wrap(&DestroyMachineCommand{}))
On 2014/05/09 06:51:55, fwereade wrote:
> Shouldn't we RemoveMachine as well? if not, why not? :)

It was intended to switch to "juju remove-machine" at least in the bug.

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/removemachine.go
File cmd/juju/removemachine.go (left):

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/removemachine.go#oldcode39
cmd/juju/removemachine.go:39: }
It seems you can't comment on a rename-only change. I wanted to note
that removemachine_test.go certainly seems like it would need updating
for the changes of DestroyMachine to RemoveMachine.

https://codereview.appspot.com/92080046/

Revision history for this message
John A Meinel (jameinel) wrote :
Revision history for this message
Jesse Meek (waigani) wrote :

On 2014/05/09 09:24:49, jameinel wrote:
> https://codereview.appspot.com/92080046/diff/40001/cmd/juju/main.go
> File cmd/juju/main.go (left):

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/main.go#oldcode83
> cmd/juju/main.go:83: jujucmd.Register(wrap(&DestroyMachineCommand{}))
> On 2014/05/09 06:51:55, fwereade wrote:
> > Shouldn't we RemoveMachine as well? if not, why not? :)

> It was intended to switch to "juju remove-machine" at least in the
bug.

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/removemachine.go
> File cmd/juju/removemachine.go (left):

https://codereview.appspot.com/92080046/diff/40001/cmd/juju/removemachine.go#oldcode39
> cmd/juju/removemachine.go:39: }
> It seems you can't comment on a rename-only change. I wanted to note
that
> removemachine_test.go certainly seems like it would need updating for
the
> changes of DestroyMachine to RemoveMachine.

Yes, you're right. It seems I'm being sloppy with my commits. I'd made
the changes but managed not to commit them, sorry.

https://codereview.appspot.com/92080046/

Revision history for this message
Jesse Meek (waigani) wrote :
Revision history for this message
Go Bot (go-bot) wrote :

Attempt to merge into lp:juju-core failed due to conflicts:

text conflict in cmd/juju/removemachine.go
text conflict in cmd/juju/removerelation.go
text conflict in cmd/juju/removeservice.go
text conflict in cmd/juju/removeunit.go

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmd/juju/cmd_test.go'
2--- cmd/juju/cmd_test.go 2014-05-09 13:24:50 +0000
3+++ cmd/juju/cmd_test.go 2014-05-11 22:53:23 +0000
4@@ -360,16 +360,16 @@
5 c.Assert(err, gc.ErrorMatches, "no service name specified")
6 }
7
8-func initDestroyUnitCommand(args ...string) (*DestroyUnitCommand, error) {
9- com := &DestroyUnitCommand{}
10+func initRemoveUnitCommand(args ...string) (*RemoveUnitCommand, error) {
11+ com := &RemoveUnitCommand{}
12 return com, coretesting.InitCommand(com, args)
13 }
14
15-func (*CmdSuite) TestDestroyUnitCommandInit(c *gc.C) {
16+func (*CmdSuite) TestRemoveUnitCommandInit(c *gc.C) {
17 // missing args
18- _, err := initDestroyUnitCommand()
19+ _, err := initRemoveUnitCommand()
20 c.Assert(err, gc.ErrorMatches, "no units specified")
21 // not a unit
22- _, err = initDestroyUnitCommand("seven/nine")
23+ _, err = initRemoveUnitCommand("seven/nine")
24 c.Assert(err, gc.ErrorMatches, `invalid unit name "seven/nine"`)
25 }
26
27=== modified file 'cmd/juju/main.go'
28--- cmd/juju/main.go 2014-04-25 13:57:06 +0000
29+++ cmd/juju/main.go 2014-05-11 22:53:23 +0000
30@@ -80,10 +80,10 @@
31 jujucmd.Register(wrap(&AddUnitCommand{}))
32
33 // Destruction commands.
34- jujucmd.Register(wrap(&DestroyMachineCommand{}))
35- jujucmd.Register(wrap(&DestroyRelationCommand{}))
36- jujucmd.Register(wrap(&DestroyServiceCommand{}))
37- jujucmd.Register(wrap(&DestroyUnitCommand{}))
38+ jujucmd.Register(wrap(&RemoveMachineCommand{}))
39+ jujucmd.Register(wrap(&RemoveRelationCommand{}))
40+ jujucmd.Register(wrap(&RemoveServiceCommand{}))
41+ jujucmd.Register(wrap(&RemoveUnitCommand{}))
42 jujucmd.Register(wrap(&DestroyEnvironmentCommand{}))
43
44 // Reporting commands.
45
46=== renamed file 'cmd/juju/destroymachine.go' => 'cmd/juju/removemachine.go'
47--- cmd/juju/destroymachine.go 2014-05-09 13:24:50 +0000
48+++ cmd/juju/removemachine.go 2014-05-11 22:53:23 +0000
49@@ -14,36 +14,43 @@
50 "launchpad.net/juju-core/names"
51 )
52
53-// DestroyMachineCommand causes an existing machine to be destroyed.
54-type DestroyMachineCommand struct {
55+// RemoveMachineCommand causes an existing machine to be destroyed.
56+type RemoveMachineCommand struct {
57 envcmd.EnvCommandBase
58 MachineIds []string
59 Force bool
60 }
61
62 const destroyMachineDoc = `
63-Machines that are responsible for the environment cannot be destroyed. Machines
64-running units or containers can only be destroyed with the --force flag; doing
65-so will also destroy all those units and containers without giving them any
66+Machines that are responsible for the environment cannot be removed. Machines
67+running units or containers can only be removed with the --force flag; doing
68+so will also remove all those units and containers without giving them any
69 opportunity to shut down cleanly.
70+
71+Examples:
72+ # Remove machine number 5 which has no running units or containers
73+ $ juju remove-machine 5
74+
75+ # Remove machine 6 and any running units or containers
76+ $ juju remove-machine 6 --force
77 `
78
79-func (c *DestroyMachineCommand) Info() *cmd.Info {
80+func (c *RemoveMachineCommand) Info() *cmd.Info {
81 return &cmd.Info{
82- Name: "destroy-machine",
83+ Name: "remove-machine",
84 Args: "<machine> ...",
85- Purpose: "destroy machines",
86+ Purpose: "remove machines from the environment",
87 Doc: destroyMachineDoc,
88- Aliases: []string{"remove-machine", "terminate-machine"},
89+ Aliases: []string{"destroy-machine", "terminate-machine"},
90 }
91 }
92
93-func (c *DestroyMachineCommand) SetFlags(f *gnuflag.FlagSet) {
94+func (c *RemoveMachineCommand) SetFlags(f *gnuflag.FlagSet) {
95 c.EnvCommandBase.SetFlags(f)
96 f.BoolVar(&c.Force, "force", false, "completely remove machine and all dependencies")
97 }
98
99-func (c *DestroyMachineCommand) Init(args []string) error {
100+func (c *RemoveMachineCommand) Init(args []string) error {
101 if err := c.EnvCommandBase.EnsureEnvName(); err != nil {
102 return err
103 }
104@@ -59,7 +66,7 @@
105 return nil
106 }
107
108-func (c *DestroyMachineCommand) Run(_ *cmd.Context) error {
109+func (c *RemoveMachineCommand) Run(_ *cmd.Context) error {
110 apiclient, err := juju.NewAPIClientFromName(c.EnvName)
111 if err != nil {
112 return err
113
114=== renamed file 'cmd/juju/destroymachine_test.go' => 'cmd/juju/removemachine_test.go'
115--- cmd/juju/destroymachine_test.go 2014-04-14 12:36:13 +0000
116+++ cmd/juju/removemachine_test.go 2014-05-11 22:53:23 +0000
117@@ -13,18 +13,18 @@
118 "launchpad.net/juju-core/testing"
119 )
120
121-type DestroyMachineSuite struct {
122+type RemoveMachineSuite struct {
123 jujutesting.RepoSuite
124 }
125
126-var _ = gc.Suite(&DestroyMachineSuite{})
127+var _ = gc.Suite(&RemoveMachineSuite{})
128
129-func runDestroyMachine(c *gc.C, args ...string) error {
130- _, err := testing.RunCommand(c, &DestroyMachineCommand{}, args)
131+func runRemoveMachine(c *gc.C, args ...string) error {
132+ _, err := testing.RunCommand(c, &RemoveMachineCommand{}, args)
133 return err
134 }
135
136-func (s *DestroyMachineSuite) TestDestroyMachineWithUnit(c *gc.C) {
137+func (s *RemoveMachineSuite) TestRemoveMachineWithUnit(c *gc.C) {
138 // Create a machine running a unit.
139 testing.Charms.BundlePath(s.SeriesPath, "riak")
140 err := runDeploy(c, "local:riak", "riak")
141@@ -38,30 +38,30 @@
142 c.Assert(mid, gc.Equals, "0")
143
144 // Try to destroy the machine and fail.
145- err = runDestroyMachine(c, "0")
146+ err = runRemoveMachine(c, "0")
147 c.Assert(err, gc.ErrorMatches, `no machines were destroyed: machine 0 has unit "riak/0" assigned`)
148 }
149
150-func (s *DestroyMachineSuite) TestDestroyEmptyMachine(c *gc.C) {
151+func (s *RemoveMachineSuite) TestDestroyEmptyMachine(c *gc.C) {
152 // Destroy an empty machine alongside a state server; only the empty machine
153 // gets destroyed.
154 m0, err := s.State.AddMachine("quantal", state.JobHostUnits)
155 c.Assert(err, gc.IsNil)
156- err = runDestroyMachine(c, "0", "1")
157+ err = runRemoveMachine(c, "0", "1")
158 c.Assert(err, gc.ErrorMatches, `some machines were not destroyed: machine 1 does not exist`)
159 err = m0.Refresh()
160 c.Assert(err, gc.IsNil)
161 c.Assert(m0.Life(), gc.Equals, state.Dying)
162
163 // Destroying a destroyed machine is a no-op.
164- err = runDestroyMachine(c, "0")
165+ err = runRemoveMachine(c, "0")
166 c.Assert(err, gc.IsNil)
167 err = m0.Refresh()
168 c.Assert(err, gc.IsNil)
169 c.Assert(m0.Life(), gc.Equals, state.Dying)
170 }
171
172-func (s *DestroyMachineSuite) TestDestroyDeadMachine(c *gc.C) {
173+func (s *RemoveMachineSuite) TestDestroyDeadMachine(c *gc.C) {
174 // Destroying a Dead machine is a no-op; destroying it alongside a JobManageEnviron
175 m0, err := s.State.AddMachine("quantal", state.JobManageEnviron)
176 c.Assert(err, gc.IsNil)
177@@ -70,7 +70,7 @@
178 c.Assert(err, gc.IsNil)
179 err = m1.EnsureDead()
180 c.Assert(err, gc.IsNil)
181- err = runDestroyMachine(c, "0", "1")
182+ err = runRemoveMachine(c, "0", "1")
183 c.Assert(err, gc.ErrorMatches, `some machines were not destroyed: machine 0 is required by the environment`)
184 err = m1.Refresh()
185 c.Assert(err, gc.IsNil)
186@@ -80,7 +80,7 @@
187 c.Assert(m0.Life(), gc.Equals, state.Alive)
188 }
189
190-func (s *DestroyMachineSuite) TestForce(c *gc.C) {
191+func (s *RemoveMachineSuite) TestForce(c *gc.C) {
192 // Create a manager machine.
193 m0, err := s.State.AddMachine("quantal", state.JobManageEnviron)
194 c.Assert(err, gc.IsNil)
195@@ -97,7 +97,7 @@
196 c.Assert(err, gc.IsNil)
197
198 // Try to force-destroy the machines.
199- err = runDestroyMachine(c, "0", "1", "--force")
200+ err = runRemoveMachine(c, "0", "1", "--force")
201 c.Assert(err, gc.ErrorMatches, `some machines were not destroyed: machine 0 is required by the environment`)
202
203 // Clean up, check state.
204@@ -115,17 +115,17 @@
205 c.Assert(m0.Life(), gc.Equals, state.Alive)
206 }
207
208-func (s *DestroyMachineSuite) TestBadArgs(c *gc.C) {
209+func (s *RemoveMachineSuite) TestBadArgs(c *gc.C) {
210 // Check invalid args.
211- err := runDestroyMachine(c)
212+ err := runRemoveMachine(c)
213 c.Assert(err, gc.ErrorMatches, `no machines specified`)
214- err = runDestroyMachine(c, "1", "2", "nonsense", "rubbish")
215+ err = runRemoveMachine(c, "1", "2", "nonsense", "rubbish")
216 c.Assert(err, gc.ErrorMatches, `invalid machine id "nonsense"`)
217 }
218
219-func (s *DestroyMachineSuite) TestEnvironmentArg(c *gc.C) {
220+func (s *RemoveMachineSuite) TestEnvironmentArg(c *gc.C) {
221 _, err := s.State.AddMachine("quantal", state.JobHostUnits)
222 c.Assert(err, gc.IsNil)
223- err = runDestroyMachine(c, "0", "-e", "dummyenv")
224+ err = runRemoveMachine(c, "0", "-e", "dummyenv")
225 c.Assert(err, gc.IsNil)
226 }
227
228=== renamed file 'cmd/juju/destroyrelation.go' => 'cmd/juju/removerelation.go'
229--- cmd/juju/destroyrelation.go 2014-05-09 13:24:50 +0000
230+++ cmd/juju/removerelation.go 2014-05-11 22:53:23 +0000
231@@ -11,22 +11,22 @@
232 "launchpad.net/juju-core/juju"
233 )
234
235-// DestroyRelationCommand causes an existing service relation to be shut down.
236-type DestroyRelationCommand struct {
237+// RemoveRelationCommand causes an existing service relation to be shut down.
238+type RemoveRelationCommand struct {
239 envcmd.EnvCommandBase
240 Endpoints []string
241 }
242
243-func (c *DestroyRelationCommand) Info() *cmd.Info {
244+func (c *RemoveRelationCommand) Info() *cmd.Info {
245 return &cmd.Info{
246- Name: "destroy-relation",
247+ Name: "remove-relation",
248 Args: "<service1>[:<relation name1>] <service2>[:<relation name2>]",
249- Purpose: "destroy a relation between two services",
250- Aliases: []string{"remove-relation"},
251+ Purpose: "remove a relation between two services",
252+ Aliases: []string{"destroy-relation"},
253 }
254 }
255
256-func (c *DestroyRelationCommand) Init(args []string) error {
257+func (c *RemoveRelationCommand) Init(args []string) error {
258 if err := c.EnsureEnvName(); err != nil {
259 return err
260 }
261@@ -37,7 +37,7 @@
262 return nil
263 }
264
265-func (c *DestroyRelationCommand) Run(_ *cmd.Context) error {
266+func (c *RemoveRelationCommand) Run(_ *cmd.Context) error {
267 client, err := juju.NewAPIClientFromName(c.EnvName)
268 if err != nil {
269 return err
270
271=== renamed file 'cmd/juju/destroyrelation_test.go' => 'cmd/juju/removerelation_test.go'
272--- cmd/juju/destroyrelation_test.go 2013-09-13 14:48:13 +0000
273+++ cmd/juju/removerelation_test.go 2014-05-11 22:53:23 +0000
274@@ -10,18 +10,18 @@
275 "launchpad.net/juju-core/testing"
276 )
277
278-type DestroyRelationSuite struct {
279+type RemoveRelationSuite struct {
280 jujutesting.RepoSuite
281 }
282
283-var _ = gc.Suite(&DestroyRelationSuite{})
284+var _ = gc.Suite(&RemoveRelationSuite{})
285
286-func runDestroyRelation(c *gc.C, args ...string) error {
287- _, err := testing.RunCommand(c, &DestroyRelationCommand{}, args)
288+func runRemoveRelation(c *gc.C, args ...string) error {
289+ _, err := testing.RunCommand(c, &RemoveRelationCommand{}, args)
290 return err
291 }
292
293-func (s *DestroyRelationSuite) TestDestroyRelation(c *gc.C) {
294+func (s *RemoveRelationSuite) TestRemoveRelation(c *gc.C) {
295 testing.Charms.BundlePath(s.SeriesPath, "riak")
296 err := runDeploy(c, "local:riak", "riak")
297 c.Assert(err, gc.IsNil)
298@@ -31,16 +31,16 @@
299 runAddRelation(c, "riak", "logging")
300
301 // Destroy a relation that exists.
302- err = runDestroyRelation(c, "logging", "riak")
303+ err = runRemoveRelation(c, "logging", "riak")
304 c.Assert(err, gc.IsNil)
305
306 // Destroy a relation that used to exist.
307- err = runDestroyRelation(c, "riak", "logging")
308+ err = runRemoveRelation(c, "riak", "logging")
309 c.Assert(err, gc.ErrorMatches, `relation "logging:info riak:juju-info" not found`)
310
311 // Invalid removes.
312- err = runDestroyRelation(c, "ping", "pong")
313+ err = runRemoveRelation(c, "ping", "pong")
314 c.Assert(err, gc.ErrorMatches, `service "ping" not found`)
315- err = runDestroyRelation(c, "riak")
316+ err = runRemoveRelation(c, "riak")
317 c.Assert(err, gc.ErrorMatches, `a relation must involve two services`)
318 }
319
320=== renamed file 'cmd/juju/destroyservice.go' => 'cmd/juju/removeservice.go'
321--- cmd/juju/destroyservice.go 2014-05-09 13:24:50 +0000
322+++ cmd/juju/removeservice.go 2014-05-11 22:53:23 +0000
323@@ -12,23 +12,23 @@
324 "launchpad.net/juju-core/names"
325 )
326
327-// DestroyServiceCommand causes an existing service to be destroyed.
328-type DestroyServiceCommand struct {
329+// RemoveServiceCommand causes an existing service to be destroyed.
330+type RemoveServiceCommand struct {
331 envcmd.EnvCommandBase
332 ServiceName string
333 }
334
335-func (c *DestroyServiceCommand) Info() *cmd.Info {
336+func (c *RemoveServiceCommand) Info() *cmd.Info {
337 return &cmd.Info{
338- Name: "destroy-service",
339+ Name: "remove-service",
340 Args: "<service>",
341- Purpose: "destroy a service",
342- Doc: "Destroying a service will destroy all its units and relations.",
343- Aliases: []string{"remove-service"},
344+ Purpose: "remove a service from the environment",
345+ Doc: "Removing a service will remove all its units and relations.",
346+ Aliases: []string{"destroy-service"},
347 }
348 }
349
350-func (c *DestroyServiceCommand) Init(args []string) error {
351+func (c *RemoveServiceCommand) Init(args []string) error {
352 if err := c.EnsureEnvName(); err != nil {
353 return err
354 }
355@@ -42,7 +42,7 @@
356 return cmd.CheckEmpty(args)
357 }
358
359-func (c *DestroyServiceCommand) Run(_ *cmd.Context) error {
360+func (c *RemoveServiceCommand) Run(_ *cmd.Context) error {
361 client, err := juju.NewAPIClientFromName(c.EnvName)
362 if err != nil {
363 return err
364
365=== renamed file 'cmd/juju/destroyservice_test.go' => 'cmd/juju/removeservice_test.go'
366--- cmd/juju/destroyservice_test.go 2013-09-13 14:48:13 +0000
367+++ cmd/juju/removeservice_test.go 2014-05-11 22:53:23 +0000
368@@ -11,40 +11,40 @@
369 "launchpad.net/juju-core/testing"
370 )
371
372-type DestroyServiceSuite struct {
373+type RemoveServiceSuite struct {
374 jujutesting.RepoSuite
375 }
376
377-var _ = gc.Suite(&DestroyServiceSuite{})
378+var _ = gc.Suite(&RemoveServiceSuite{})
379
380-func runDestroyService(c *gc.C, args ...string) error {
381- _, err := testing.RunCommand(c, &DestroyServiceCommand{}, args)
382+func runRemoveService(c *gc.C, args ...string) error {
383+ _, err := testing.RunCommand(c, &RemoveServiceCommand{}, args)
384 return err
385 }
386
387-func (s *DestroyServiceSuite) TestSuccess(c *gc.C) {
388+func (s *RemoveServiceSuite) TestSuccess(c *gc.C) {
389 // Destroy a service that exists.
390 testing.Charms.BundlePath(s.SeriesPath, "riak")
391 err := runDeploy(c, "local:riak", "riak")
392 c.Assert(err, gc.IsNil)
393- err = runDestroyService(c, "riak")
394+ err = runRemoveService(c, "riak")
395 c.Assert(err, gc.IsNil)
396 riak, err := s.State.Service("riak")
397 c.Assert(err, gc.IsNil)
398 c.Assert(riak.Life(), gc.Equals, state.Dying)
399 }
400
401-func (s *DestroyServiceSuite) TestFailure(c *gc.C) {
402+func (s *RemoveServiceSuite) TestFailure(c *gc.C) {
403 // Destroy a service that does not exist.
404- err := runDestroyService(c, "gargleblaster")
405+ err := runRemoveService(c, "gargleblaster")
406 c.Assert(err, gc.ErrorMatches, `service "gargleblaster" not found`)
407 }
408
409-func (s *DestroyServiceSuite) TestInvalidArgs(c *gc.C) {
410- err := runDestroyService(c)
411+func (s *RemoveServiceSuite) TestInvalidArgs(c *gc.C) {
412+ err := runRemoveService(c)
413 c.Assert(err, gc.ErrorMatches, `no service specified`)
414- err = runDestroyService(c, "ping", "pong")
415+ err = runRemoveService(c, "ping", "pong")
416 c.Assert(err, gc.ErrorMatches, `unrecognized args: \["pong"\]`)
417- err = runDestroyService(c, "invalid:name")
418+ err = runRemoveService(c, "invalid:name")
419 c.Assert(err, gc.ErrorMatches, `invalid service name "invalid:name"`)
420 }
421
422=== renamed file 'cmd/juju/destroyunit.go' => 'cmd/juju/removeunit.go'
423--- cmd/juju/destroyunit.go 2014-05-09 13:24:50 +0000
424+++ cmd/juju/removeunit.go 2014-05-11 22:53:23 +0000
425@@ -13,22 +13,22 @@
426 "launchpad.net/juju-core/names"
427 )
428
429-// DestroyUnitCommand is responsible for destroying service units.
430-type DestroyUnitCommand struct {
431+// RemoveUnitCommand is responsible for destroying service units.
432+type RemoveUnitCommand struct {
433 envcmd.EnvCommandBase
434 UnitNames []string
435 }
436
437-func (c *DestroyUnitCommand) Info() *cmd.Info {
438+func (c *RemoveUnitCommand) Info() *cmd.Info {
439 return &cmd.Info{
440- Name: "destroy-unit",
441+ Name: "remove-unit",
442 Args: "<unit> [...]",
443- Purpose: "destroy service units",
444- Aliases: []string{"remove-unit"},
445+ Purpose: "remove service units from the environment",
446+ Aliases: []string{"destroy-unit"},
447 }
448 }
449
450-func (c *DestroyUnitCommand) Init(args []string) error {
451+func (c *RemoveUnitCommand) Init(args []string) error {
452 if err := c.EnsureEnvName(); err != nil {
453 return err
454 }
455@@ -46,7 +46,7 @@
456
457 // Run connects to the environment specified on the command line and destroys
458 // units therein.
459-func (c *DestroyUnitCommand) Run(_ *cmd.Context) error {
460+func (c *RemoveUnitCommand) Run(_ *cmd.Context) error {
461 client, err := juju.NewAPIClientFromName(c.EnvName)
462 if err != nil {
463 return err
464
465=== renamed file 'cmd/juju/destroyunit_test.go' => 'cmd/juju/removeunit_test.go'
466--- cmd/juju/destroyunit_test.go 2013-09-13 14:48:13 +0000
467+++ cmd/juju/removeunit_test.go 2014-05-11 22:53:23 +0000
468@@ -12,25 +12,25 @@
469 "launchpad.net/juju-core/testing"
470 )
471
472-type DestroyUnitSuite struct {
473+type RemoveUnitSuite struct {
474 jujutesting.RepoSuite
475 }
476
477-var _ = gc.Suite(&DestroyUnitSuite{})
478+var _ = gc.Suite(&RemoveUnitSuite{})
479
480-func runDestroyUnit(c *gc.C, args ...string) error {
481- _, err := testing.RunCommand(c, &DestroyUnitCommand{}, args)
482+func runRemoveUnit(c *gc.C, args ...string) error {
483+ _, err := testing.RunCommand(c, &RemoveUnitCommand{}, args)
484 return err
485 }
486
487-func (s *DestroyUnitSuite) TestDestroyUnit(c *gc.C) {
488+func (s *RemoveUnitSuite) TestRemoveUnit(c *gc.C) {
489 testing.Charms.BundlePath(s.SeriesPath, "dummy")
490 err := runDeploy(c, "-n", "2", "local:dummy", "dummy")
491 c.Assert(err, gc.IsNil)
492 curl := charm.MustParseURL("local:precise/dummy-1")
493 svc, _ := s.AssertService(c, "dummy", curl, 2, 0)
494
495- err = runDestroyUnit(c, "dummy/0", "dummy/1", "dummy/2", "sillybilly/17")
496+ err = runRemoveUnit(c, "dummy/0", "dummy/1", "dummy/2", "sillybilly/17")
497 c.Assert(err, gc.ErrorMatches, `some units were not destroyed: unit "dummy/2" does not exist; unit "sillybilly/17" does not exist`)
498 units, err := svc.AllUnits()
499 c.Assert(err, gc.IsNil)

Subscribers

People subscribed via source and target branches

to status/vote changes: