Sha256: daace5bcc7bfdf10a2fc40397a15a75019266490a7dd5a147e2072fd8e7f2a70

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

module VagrantPlugins
  module VCenter
    module Action
      # This class powers off the VM that the Vagrant provider is managing.
      class PowerOff
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new('vagrant_vcenter::action::poweroff')
        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

          # Poweroff VM
          env[:ui].info('Powering off VM...')
          vm.PowerOffVM_Task.wait_for_completion

          @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_off.rb