Sha256: 4d85b5ea094095895a36fda2809340f7540be2ccab4bfd12f31e2972fd21ec92
Contents?: true
Size: 901 Bytes
Versions: 3
Compression:
Stored size: 901 Bytes
Contents
require 'i18n' module VagrantPlugins module VCenter module Action # This class powers on the VM that the Vagrant provider is managing. class PowerOn def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant_vcenter::action::power_on') end def call(env) config = env[:machine].provider_config # FIXME: Raise a correct exception dc = config.vcenter_cnx.serviceInstance.find_datacenter( config.datacenter_name) or abort 'datacenter not found' root_vm_folder = dc.vmFolder vm = root_vm_folder.findByUuid(env[:machine].id) # Poweron VM env[:ui].info('Powering on VM...') vm.PowerOnVM_Task.wait_for_completion sleep(3) until env[:machine].communicate.ready? @app.call env end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems