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

Side by Side Diff: cmd/juju/destroyunit.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
« no previous file with comments | « cmd/juju/destroyrelation.go ('k') | cmd/juju/environment.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012, 2013 Canonical Ltd. 1 // Copyright 2012, 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 "errors" 7 "errors"
8 "fmt" 8 "fmt"
9 9
10 "launchpad.net/juju-core/cmd" 10 "launchpad.net/juju-core/cmd"
(...skipping 26 matching lines...) Expand all
37 for _, name := range c.UnitNames { 37 for _, name := range c.UnitNames {
38 if !names.IsUnit(name) { 38 if !names.IsUnit(name) {
39 return fmt.Errorf("invalid unit name %q", name) 39 return fmt.Errorf("invalid unit name %q", name)
40 } 40 }
41 } 41 }
42 return nil 42 return nil
43 } 43 }
44 44
45 // Run connects to the environment specified on the command line and destroys 45 // Run connects to the environment specified on the command line and destroys
46 // units therein. 46 // units therein.
47 func (c *DestroyUnitCommand) Run(_ *cmd.Context) (err error) { 47 func (c *DestroyUnitCommand) Run(_ *cmd.Context) error {
48 conn, err := juju.NewConnFromName(c.EnvName) 48 conn, err := juju.NewConnFromName(c.EnvName)
49 if err != nil { 49 if err != nil {
50 return err 50 return err
51 } 51 }
52 defer conn.Close() 52 defer conn.Close()
53 params := params.DestroyServiceUnits{ 53 params := params.DestroyServiceUnits{
54 UnitNames: c.UnitNames, 54 UnitNames: c.UnitNames,
55 } 55 }
56 return statecmd.DestroyServiceUnits(conn.State, params) 56 return statecmd.DestroyServiceUnits(conn.State, params)
57 } 57 }
OLDNEW
« no previous file with comments | « cmd/juju/destroyrelation.go ('k') | cmd/juju/environment.go » ('j') | no next file with comments »

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