mitchellh / vagrant-aws

Use Vagrant to manage your EC2 and VPC instances.
MIT License
2.61k stars 574 forks source link

Vagrant doesn't terminate instance on error #477

Open kenorb opened 8 years ago

kenorb commented 8 years ago

I'm running instance as:

$ vagrant up --provider=aws --no-provision --destroy-on-error
Launching an instance with the following settings...
 -- Type: t2.small
 -- AMI: ami-xxx
 -- Region: us-east-1
 -- Keypair: Test
 -- Subnet ID: subnet-abc
 -- Block Device Mapping: []
 -- Terminate On Shutdown: 1
 -- Monitoring: false
 -- EBS optimized: false
 -- Source Destination check: 
 -- Assigning a public IP address in a VPC: false
 -- VPC tenancy specification: default

and my instance fails with exit 1, however my AWS instance is still running. This happens on each time.

Example error:

==> mt-aws: gzip: 
==> mt-aws: /home/ubuntu/foo: No space left on device
==> mt-aws: ERROR: Exiting /vagrant/scripts/get_bt_data.sh with 1
==> mt-aws: 592 onerror /vagrant/scripts/.funcs.inc.sh
==> mt-aws: 49 main /vagrant/scripts/get_bt_data.sh
==> mt-aws: ++ onerror
==> mt-aws: ++ local exit_status=1
==> mt-aws: ++ local frame=0
==> mt-aws: ++ echo 'ERROR: Exiting /vagrant/scripts/run_backtest.sh with 1'
==> mt-aws: ERROR: Exiting /vagrant/scripts/run_backtest.sh with 1
==> mt-aws: + exit 1
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

So each time I had to terminate my instance manually from the EC2 console on error. Expected behaviour would be to terminate the instance on error (as per --destroy-on-error and aws.terminate_on_shutdown).