Class: VagrantPlugins::SimpleCloud::Actions::Destroy
- Inherits:
-
Object
- Object
- VagrantPlugins::SimpleCloud::Actions::Destroy
- Includes:
- Helpers::Client
- Defined in:
- lib/vagrant-simplecloud/actions/destroy.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Destroy
constructor
A new instance of Destroy.
Methods included from Helpers::Client
Constructor Details
#initialize(app, env) ⇒ Destroy
Returns a new instance of Destroy.
9 10 11 12 13 14 |
# File 'lib/vagrant-simplecloud/actions/destroy.rb', line 9 def initialize(app, env) @app = app @machine = env[:machine] @simple_client = simple_client @logger = Log4r::Logger.new('vagrant::simplecloud::destroy') end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vagrant-simplecloud/actions/destroy.rb', line 16 def call(env) # submit destroy droplet request @simple_client.delete("/v2/droplets/#{@machine.id}") env[:ui].info I18n.t('vagrant_simple_cloud.info.destroying') # set the machine id to nil to cleanup local vagrant state @machine.id = nil @app.call(env) end |