Merge lp:~rogpeppe/juju-core/548-destroy-environment-fix into lp:~go-bot/juju-core/trunk
Proposed by
Roger Peppe
Status: | Merged |
---|---|
Approved by: | Roger Peppe |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2632 |
Proposed branch: | lp:~rogpeppe/juju-core/548-destroy-environment-fix |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
104 lines (+29/-31) 2 files modified
cmd/juju/destroyenvironment.go (+28/-30) cmd/juju/status.go (+1/-1) |
To merge this branch: | bzr merge lp:~rogpeppe/juju-core/548-destroy-environment-fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+215697@code.launchpad.net |
Commit message
cmd/juju: destroy-environment api connect fix
destroy-environment was not using the .jenv file
information to connect, which meant that it failed
when destroying a HA environment, because we
are not currently updating the environment-storage
instance ids.
Description of the change
cmd/juju: destroy-environment api connect fix
destroy-environment was not using the .jenv file
information to connect, which meant that it failed
when destroying a HA environment, because we
are not currently updating the environment-storage
instance ids.
To post a comment you must log in.
Reviewers: mp+215697_ code.launchpad. net,
Message:
Please take a look.
Description:
cmd/juju: destroy-environment api connect fix
destroy-environment was not using the .jenv file
information to connect, which meant that it failed
when destroying a HA environment, because we
are not currently updating the environment-storage
instance ids.
https:/ /code.launchpad .net/~rogpeppe/ juju-core/ 548-destroy- environment- fix/+merge/ 215697
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/87560044/
Affected files (+31, -31 lines): destroyenvironm ent.go
A [revision details]
M cmd/juju/
M cmd/juju/status.go
Index: [revision details] 20140414112125- eouvcipf4rmjrah n
=== 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-
+New revision: <email address hidden>
Index: cmd/juju/ destroyenvironm ent.go destroyenvironm ent.go' destroyenvironm ent.go 2014-03-26 22:21:59 +0000 destroyenvironm ent.go 2014-04-14 15:47:12 +0000 net/juju- core/environs" net/juju- core/environs/ configstore" net/juju- core/juju" net/juju- core/state/ api" net/juju- core/state/ api/params"
=== modified file 'cmd/juju/
--- cmd/juju/
+++ cmd/juju/
@@ -16,7 +16,6 @@
"launchpad.
"launchpad.
"launchpad.
- "launchpad.
"launchpad.
)
@@ -47,6 +46,30 @@ &c.envName, "environment", "", "juju environment to operate
f.StringVar(
in")
}
+func (c *DestroyEnviron mentCommand) Init(args []string) error { Warningf( "-e/--environme nt flag is deprecated in 1.18, " + ntError args[1: ]) mentCommand) Run(ctx *cmd.Context) (result error) { Default( )
+ if c.envName != "" {
+ logger.
+ "please supply environment as a positional parameter")
+ // They supplied the -e flag
+ if len(args) == 0 {
+ // We're happy, we have enough information
+ return nil
+ }
+ // You can't supply -e ENV and ENV as a positional argument
+ return DoubleEnvironme
+ }
+ // No -e flag means they must supply the environment positionally
+ switch len(args) {
+ case 0:
+ return NoEnvironmentError
+ case 1:
+ c.envName = args[0]
+ return nil
+ default:
+ return cmd.CheckEmpty(
+ }
+}
+
func (c *DestroyEnviron
store, err := configstore.
if err != nil {
@@ -95,12 +118,12 @@
`, c.envName) (environ, api.DefaultDial Opts()) ntFromName( c.envName) Client( ).DestroyEnviro nment() DestroyEnvironm ent() IsCodeNotImplem ented(err) { "destroying environment: %v", err) Destroy( environ, store)
}()
- conn, err := juju.NewAPIConn
+ apiclient, err := juju.NewAPIClie
if err != nil {
- return err
+ return fmt.Errorf("cannot connect to API: %v", err)
}
- defer conn.Close()
- err = conn.State.
+ defer apiclient.Close()
+ err = apiclient.
if err != nil && !params.
return fmt.Errorf(
}
@@ -108,31 +131,6 @@
return environs.
}
-func (c *DestroyEnviron mentCommand) Init(args []string) error { Warningf( "-e/--environme nt flag is deprecated in 1.18, " +
- if c.envName != "" {
- logger.
- "please supply environment as a positional parameter")
- // They supplied the -e flag
- if len(args) == 0 {
- // We're hap...