Class: VagrantPlugins::DigitalOcean::Actions::Destroy
- Inherits:
-
Object
- Object
- VagrantPlugins::DigitalOcean::Actions::Destroy
- Includes:
- Vagrant::Util::Retryable
- Defined in:
- lib/vagrant-digitalocean/actions/destroy.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Destroy
constructor
A new instance of Destroy.
Constructor Details
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vagrant-digitalocean/actions/destroy.rb', line 15 def call(env) # TODO remove the key associated with this machine if [:active, :new].include?(env[:machine].state.id) env[:ui].info @translator.t("destroying") result = @client.request("/droplets/#{env[:machine].id}/destroy") env[:ui].info @translator.t("wait_off") retryable(:tries => 30, :sleep => 10) do # If we're interrupted don't worry about waiting next if env[:interrupted] # Wait for the server to be ready raise "not off" if env[:machine].state.id != :off end else env[:ui].info @translator.t("not_active_or_new") end # make sure to remove the export when the machine is destroyed # private in some hosts and requires a send env[:ui].info @translator.t("clean_nfs") env[:host].send(:nfs_cleanup, env[:machine].id) @app.call(env) end |