Sha256: 7ab4128c96043f38cfd5db7d24b09f93bfd23f1354154dd3b748e86a69e04a8e

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

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)
          cfg = env[:machine].provider_config

          vm = cfg.vmfolder.findByUuid(env[:machine].id) or
               fail Errors::VMNotFound,
                    :vm_name => env[:machine].name

          # Poweron VM
          env[:ui].info('Powering on VM...')
          vm.PowerOnVM_Task.wait_for_completion
          sleep(20) until env[:machine].communicate.ready?

          @app.call env
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-vcenter-0.3.3 lib/vagrant-vcenter/action/power_on.rb