Sha256: ad6b51c4ab1033f88388e11a316c1884fca1a2b3090f1d5aadef0f3b5aa59293
Contents?: true
Size: 825 Bytes
Versions: 8
Compression:
Stored size: 825 Bytes
Contents
require 'i18n' module VagrantPlugins module VCenter module Action # This class suspends the VM when it's powered on. class Suspend def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant_vcenter::action::suspend') 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) # Poweroff VM env[:ui].info('Suspending VM...') vm.SuspendVM_Task.wait_for_completion @app.call env end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems