Class: VagrantPlugins::Proxmox::Action::DestroyVm
- Inherits:
-
ProxmoxAction
- Object
- ProxmoxAction
- VagrantPlugins::Proxmox::Action::DestroyVm
- Defined in:
- lib/vagrant-proxmox/action/destroy_vm.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ DestroyVm
constructor
A new instance of DestroyVm.
Constructor Details
#initialize(app, env) ⇒ DestroyVm
Returns a new instance of DestroyVm.
7 8 9 |
# File 'lib/vagrant-proxmox/action/destroy_vm.rb', line 7 def initialize app, env @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vagrant-proxmox/action/destroy_vm.rb', line 11 def call env env[:ui].info I18n.t('vagrant_proxmox.destroying_vm') node, vm_id = env[:machine].id.split '/' endpoint = env[:machine].provider_config.endpoint response = RestClient.delete "#{endpoint}/nodes/#{node}/openvz/#{vm_id}", {CSRFPreventionToken: env[:proxmox_csrf_prevention_token], cookies: {PVEAuthCookie: env[:proxmox_ticket]}} wait_for_completion parse_task_id(response), node, env, 'vagrant_proxmox.errors.destroy_vm_timeout' env[:ui].info I18n.t('vagrant_proxmox.done') next_action env end |