Sha256: ecfeac7b074244e3a62e3e7fa55be10a4b28919c7cfb6c09a00bfa06bb86732c
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
module VagrantPlugins module VCloud module Action class PowerOff def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant_vcloud::action::poweroff') end def call(env) cfg = env[:machine].provider_config cnx = cfg.vcloud_cnx.driver vapp_id = env[:machine].get_vapp_id vm_id = env[:machine].id test_vapp = cnx.get_vapp(vapp_id) @logger.debug( "Number of VMs in the vApp: #{test_vapp[:vms_hash].count}" ) if test_vapp[:vms_hash].count == 1 # Poweroff vApp env[:ui].info('Powering off vApp...') vapp_stop_task = cnx.poweroff_vapp(vapp_id) vapp_stop_wait = cnx.wait_task_completion(vapp_stop_task) unless vapp_stop_wait[:errormsg].nil? fail Errors::StopVAppError, :message => vapp_stop_wait[:errormsg] end else # Poweroff VM env[:ui].info('Powering off VM...') task_id = cnx.poweroff_vm(vm_id) cnx.wait_task_completion(task_id) end @app.call env end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vagrant-vcloud-0.2.2 | lib/vagrant-vcloud/action/power_off.rb |
vagrant-vcloud-0.2.1 | lib/vagrant-vcloud/action/power_off.rb |
vagrant-vcloud-0.2.0 | lib/vagrant-vcloud/action/power_off.rb |