Prompt user for confirmation when terminating an instance. #23

Merged
merged 1 commit into from Apr 19, 2013

Projects

None yet

4 participants

@jamescarr

Currently when running "vagrant destroy" against a box that is an EC2 instance it just terminates the box without prompting the user.

This addition seems like it should work but I have no way of testing it. I'd LOVE to have an automated spec against it but I am unsure of how to do so. :(

@jamescarr

As an aside, I tried to test this with the following vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = 'dummy'
  config.vm.box_url = 'https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box'

  config.vm.provider :aws do |aws|
    aws.access_key_id = ENV["AWS_ACCESS_KEY_ID"]
    aws.secret_access_key = ENV["AWS_SECRET_ACCESS_KEY"]
    aws.keypair_name = ENV["AWS_KEYPAIR_NAME"]
    aws.region = "us-west-2"
    aws.ami = "ami-87654321"
    aws.ssh_username = "ubuntu"
    aws.ssh_private_key_path = ENV["AWS_SSH_PRIVKEY"]
    aws.instance_type = "t1.micro"
    aws.tags = {
      'role' => 'testbox',
      'Name' => 'test-server'
    }
    aws.security_groups = ['default']
  end
end

Running this on rvm with ruby 1.9.3 on Mac OSX Mountain Lion:

bundle && bundle exec rake && bundle exec vagrant up --provider=aws

and wound up with this error that the aws provider could not be found. I also tried --provider=vagrant-aws.

Screen Shot 2013-03-29 at 12 37 36 AM

@chooper
chooper commented Mar 30, 2013

👍 regarding the title/original issue here. This should probably be consistent with the behavior of the VirtualBox provider, which prompts on destroy.

@mitchellh
Owner

Unfortunately the DestroyConfirm middleware isn't built-in to Vagrant. But it probably should be... going to do that now.

@jamescarr

cool

@johntdyer

👍

@mitchellh
Owner

I added the built-in middleware: mitchellh/vagrant@780a312

@mitchellh
Owner

And merged!

@mitchellh mitchellh merged commit b3e5f4f into mitchellh:master Apr 19, 2013
@jamescarr

Yay!

@jamescarr jamescarr deleted the jamescarr:prompt-on-instance-termination branch May 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment