Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'vagrant rebuild' should ask for confirmation before destroying a droplet #236

Open
eyemyth opened this issue May 6, 2016 · 2 comments
Open

Comments

@eyemyth
Copy link

eyemyth commented May 6, 2016

I just lost a droplet to 'vagrant rebuild'. It should provide the same confirmation as the usual 'vagrant destroy'.

Luckily the droplet I accidentally destroyed wasn't super important.

@davidalger
Copy link

@eyemyth Something you could try that would solve this for you in your setups is to use the vagrant-triggers plugin to put up a warning. I've done that here, and you're welcome to copy that snippet into your own project if you'd like:

  # verify with user before allowing a rebuild to take place
  conf.trigger.before :rebuild do
    confirm = nil
    until ["Y", "y", "N", "n"].include?(confirm)
      puts "The rebuild command is a potentially destructive operation. All data on the VM will be erased!"
      confirm = ask "Are you sure you want to rebuild the VM? [y/N] "
    end
    exit unless confirm.upcase == "Y"
  end

@webhive
Copy link

webhive commented Jun 29, 2017

Damn! Just accidently lost a droplet too :(
Restored from 3-days ago backup but anyway too dangerous operation.
And btw I was trying just to see a command help

vagrant rebuild --help 

So I got help message and command rebuild executed right after it. So first of my hosts has been lost immediately without any prompt. And I am completely disagree about this is nice-to-have feature - it should be must-have mandatory feature.

@davidalger script is very useful but no doubts it should be default behaviour without any additional scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants