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

Issue 14502070: Add safety belt to destroy-environment

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 6 months ago by natefinch
Modified:
10 years, 6 months ago
Reviewers:
mp+191501, thumper, rog
Visibility:
Public.

Description

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_name>". The flag 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)

Patch Set 1 #

Patch Set 2 : Add safety belt to destroy-environment #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+49 lines, -22 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/cmd_test.go View 1 7 chunks +15 lines, -12 lines 0 comments Download
M cmd/juju/destroyenvironment.go View 1 4 chunks +32 lines, -10 lines 1 comment Download

Messages

Total messages: 6
natefinch
Please take a look.
10 years, 6 months ago (2013-10-16 20:50:46 UTC) #1
rog
On 2013/10/16 20:50:46, nate.finch wrote: > Please take a look. Please no! I want to ...
10 years, 6 months ago (2013-10-17 07:45:25 UTC) #2
natefinch
Please take a look.
10 years, 6 months ago (2013-10-17 17:46:09 UTC) #3
natefinch
I updated the code so that the -y flag is back, but you must always ...
10 years, 6 months ago (2013-10-17 18:54:12 UTC) #4
thumper
LGTM I think this is an overall improvement to the UI. Still scriptable IMO. https://codereview.appspot.com/14502070/diff/5001/cmd/juju/destroyenvironment.go ...
10 years, 6 months ago (2013-10-31 22:06:09 UTC) #5
natefinch
10 years, 6 months ago (2013-11-04 21:33:55 UTC) #6
On 2013/10/31 22:06:09, thumper wrote:
> LGTM
> 
> I think this is an overall improvement to the UI.  Still scriptable IMO.
> 
>
https://codereview.appspot.com/14502070/diff/5001/cmd/juju/destroyenvironment.go
> File cmd/juju/destroyenvironment.go (right):
> 
>
https://codereview.appspot.com/14502070/diff/5001/cmd/juju/destroyenvironment...
> cmd/juju/destroyenvironment.go:54: scanner := bufio.NewScanner(ctx.Stdin)
> Just curious, but what benefit do we get over using bufio.NewScanner over
> fmt.Fscanln?

 fmt.Fscanln actually fails to return the entire string, and returns an error
about no EOL.  We were ignoring it, but it bit me when I was twiddling with the
code and tried to get it to read the full line... so I figured it was better to
make the code a good example rather than a bad example, even if functionally it
behaved the same in this particular case.
Sign in to reply to this message.

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