Merge lp://staging/~natefinch/juju-core/022-destroyer into lp://staging/~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | Nate Finch |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2022 |
Proposed branch: | lp://staging/~natefinch/juju-core/022-destroyer |
Merge into: | lp://staging/~go-bot/juju-core/trunk |
Diff against target: |
187 lines (+47/-22) 2 files modified
cmd/juju/cmd_test.go (+15/-12) cmd/juju/destroyenvironment.go (+32/-10) |
To merge this branch: | bzr merge lp://staging/~natefinch/juju-core/022-destroyer |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+191501@code.staging.launchpad.net |
Commit message
Destroy environment now requires that you always type the name of the environment you're destroying, it will not use the default or current environment. This is to prevent people from accidentally destroying the wrong environment, since no one really reads the warning messages, and destroy environment is pretty cataclysmic.
Description of the change
Add safety belt to destroy-environment
Destroy-environment is dangerous and we should prevent people from shooting themselves in the foot if at all possible. This change removes the -y flag from destroy-environment and changes the "are you sure?" prompt to force the user to type "destroy <environment_
Reviewers: mp+191501_ code.launchpad. net,
Message:
Please take a look.
Description:
Add safety belt to destroy-environment
Destroy-environment is dangerous and we should prevent people from name>". The flag
shooting themselves in the foot if at all possible. This change removes
the -y flag from destroy-environment and changes the "are you sure?"
prompt to force the user to type "destroy <environment_
is too easy to pass without ththinking, and the y at the prompt is
similarly too easy to type in without the user actually thinking about
what they're doing. Forcing them to type the environment name will also
ensure they don't accidentally destroy the wrong environment by
accident.
https:/ /code.launchpad .net/~natefinch /juju-core/ 022-destroyer/ +merge/ 191501
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/14502070/
Affected files (+33, -44 lines): cmd_test. go destroyenvironm ent.go
A [revision details]
M cmd/juju/
M cmd/juju/
Index: [revision details] 20131016154732- 13eh4uj8dhsfc1m w
=== 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/ cmd_test. go cmd_test. go' cmd_test. go 2013-10-10 23:17:43 +0000 cmd_test. go 2013-10-16 20:26:42 +0000
=== modified file 'cmd/juju/
--- cmd/juju/
+++ cmd/juju/
@@ -160,6 +160,10 @@
}
func (*CmdSuite) TestDestroyEnvi ronmentCommand( c *gc.C) { ext() Default( )
+ var stdin bytes.Buffer
+ ctx := cmd.DefaultCont
+ ctx.Stdin = &stdin
+
// Prepare the environment so we can destroy it.
store, err := configstore.
c.Assert(err, gc.IsNil)
@@ -171,7 +175,8 @@
c.Assert(err, gc.IsNil)
// normal destroy nullContext( ), ronmentCommand) , "--yes") ng("destroy peckham") ronmentCommand) ) (<-opc) .(dummy. OpDestroy) .Env, gc.Equals, "peckham")
- opc, errc := runCommand(
new(DestroyEnvi
+ stdin.WriteStri
+ opc, errc := runCommand(ctx, new(DestroyEnvi
c.Check(<-errc, gc.IsNil)
c.Check(
@@ -183,26 +188,13 @@
c.Assert(err, gc.IsNil)
// destroy with broken environment nullContext( ), ronmentCommand) , "--yes", "-e", "brokenenv") ng("destroy brokenenv") ronmentCommand) , "-e", "brokenenv")
- opc, errc = runCommand(
new(DestroyEnvi
+ stdin.WriteStri
+ opc, errc = runCommand(ctx,
new(DestroyEnvi
c.Check(<-opc, gc.IsNil)
c.Check(<-errc, gc.ErrorMatches, "dummy.Destroy is broken")
c.Check(<-opc, gc.IsNil)
}
-func (*CmdSuite) TestDestroyEnvi ronmentCommandC onfirmationFlag (c *gc.C) { ronmentCommand) coretesting. InitCommand( com, nil), gc.IsNil) com.assumeYes, gc.Equals, false) ronmentCommand) coretesting. InitCommand( com, []string{"-y"}), gc.IsNil) com.assumeYes, gc.Equals, true) ronmentCommand) coretesting. InitCommand( com, []string{"--yes"}), gc.IsNil) com.assumeYes, gc.Equals, true) ronmentCommandC onfirmation( c *gc.C) { ex...
- com := new(DestroyEnvi
- c.Check(
- c.Check(
-
- com = new(DestroyEnvi
- c.Check(
- c.Check(
-
- com = new(DestroyEnvi
- c.Check(
- c.Check(
-}
-
func (*CmdSuite) TestDestroyEnvi
var stdin, stdout bytes.Buffer
ctx := cmd.DefaultCont