Sha256: e6efb87c7ad0190d137dd892e5b48d7a1d7ce1797499ca7f90850d9caa3b02af

Contents?: true

Size: 783 Bytes

Versions: 12

Compression:

Stored size: 783 Bytes

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}"
          )

          # Poweroff VM
          env[:ui].info('Powering off VM...')
          task_id = cnx.poweroff_vm(vm_id)
          cnx.wait_task_completion(task_id)

          @app.call env
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vagrant-vcloud-0.5.0 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.4.7 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.4.6 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.4.4 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.4.3 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.4.2 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.4.1 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.4.0 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.3.3 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.3.2 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.3.1 lib/vagrant-vcloud/action/power_off.rb
vagrant-vcloud-0.3.0 lib/vagrant-vcloud/action/power_off.rb