Class: VmShepherd::Vcloud::Deployer

Inherits:
Object
  • Object
show all
Extended by:
RetryHelper
Defined in:
lib/vm_shepherd/vcloud/deployer.rb

Constant Summary

Constants included from RetryHelper

RetryHelper::RETRY_INTERVAL, RetryHelper::RETRY_LIMIT

Class Method Summary collapse

Methods included from RetryHelper

retry_until

Class Method Details

.deploy_and_power_on_vapp(client:, ovf_dir:, vapp_config:, vdc_name:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vm_shepherd/vcloud/deployer.rb', line 8

def self.deploy_and_power_on_vapp(client:, ovf_dir:, vapp_config:, vdc_name:)
  catalog = client.create_catalog(vapp_config.catalog)

  # upload template and instantiate vapp
  catalog.upload_vapp_template(vdc_name, vapp_config.name, ovf_dir)

  # instantiate template
  network_config                = VCloudSdk::NetworkConfig.new(vapp_config.network, 'Network 1')
  vapp                          = catalog.instantiate_vapp_template(vapp_config.name, vdc_name, vapp_config.name, nil, nil, network_config)

  # reconfigure vm
  vm = retry_until(retry_limit: 10, retry_interval: 10) do
    vapp.vms.first
  end

  vm.product_section_properties = vapp_config.build_properties

  # power on vapp
  vapp.power_on
end