OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package main | 4 package main |
5 | 5 |
6 import ( | 6 import ( |
7 "fmt" | 7 "fmt" |
8 | 8 |
9 "launchpad.net/juju-core/cmd" | 9 "launchpad.net/juju-core/cmd" |
10 "launchpad.net/juju-core/juju" | 10 "launchpad.net/juju-core/juju" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 for _, id := range args { | 34 for _, id := range args { |
35 if !names.IsMachine(id) { | 35 if !names.IsMachine(id) { |
36 return fmt.Errorf("invalid machine id %q", id) | 36 return fmt.Errorf("invalid machine id %q", id) |
37 } | 37 } |
38 } | 38 } |
39 c.MachineIds = args | 39 c.MachineIds = args |
40 return nil | 40 return nil |
41 } | 41 } |
42 | 42 |
43 func (c *DestroyMachineCommand) Run(_ *cmd.Context) error { | 43 func (c *DestroyMachineCommand) Run(ctx *cmd.Context) (err error) { |
44 conn, err := juju.NewConnFromName(c.EnvName) | 44 conn, err := juju.NewConnFromName(c.EnvName) |
45 if err != nil { | 45 if err != nil { |
46 return err | 46 return err |
47 } | 47 } |
48 defer conn.Close() | 48 defer conn.Close() |
49 return conn.State.DestroyMachines(c.MachineIds...) | 49 return conn.State.DestroyMachines(c.MachineIds...) |
50 } | 50 } |
OLD | NEW |