diff --git a/lib/vagrant-packet/action/terminate_instance.rb b/lib/vagrant-packet/action/terminate_instance.rb index 9242b34..dad254d 100644 --- a/lib/vagrant-packet/action/terminate_instance.rb +++ b/lib/vagrant-packet/action/terminate_instance.rb @@ -18,8 +18,12 @@ def call(env) # Destroy the server and remove the tracking ID env[:ui].info(I18n.t('vagrant_packet.terminating')) - server.destroy - env[:machine].id = nil + begin + server.destroy + env[:machine].id = nil + rescue Exception => e + env[:ui].info(I18n.t('vagrant_packet.terminate_while_provisioning')) + end @app.call(env) end diff --git a/locales/en.yml b/locales/en.yml index a85f7d2..60c1f05 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -22,6 +22,9 @@ en: Stopping the instance... terminating: |- Terminating the instance... + terminate_while_provisioning: |- + Cannot destroy a machine while provisioning. + Wait for provisioning to finish then try again. waiting_for_ready: |- Waiting for instance to become "ready"... waiting_for_ssh: |-