Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1112)

Side by Side Diff: cmd/juju/destroymachine.go

Issue 12546043: return error on no environment
Patch Set: return error on no environment Created 10 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
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
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) {
rog 2013/08/08 17:25:41 ditto
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 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b