Skip to content

Commit

Permalink
trap trying to destroy while provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Sica committed Jul 1, 2018
1 parent c5654db commit 2316760
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/vagrant-packet/action/terminate_instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down

0 comments on commit 2316760

Please sign in to comment.