Sha256: 1e19b6670ff09ab08d3aa29b3ff8655cc1b1c298ca656dfd04a207becbd0e6ff
Contents?: true
Size: 1.56 KB
Versions: 4
Compression:
Stored size: 1.56 KB
Contents
module Vcloud module Launcher class VappOrchestrator def self.provision(vapp_config) name, vdc_name = vapp_config[:name], vapp_config[:vdc_name] if vapp = Vcloud::Core::Vapp.get_by_name_and_vdc_name(name, vdc_name) Vcloud::Launcher.logger.info("Found existing vApp #{name} in vDC '#{vdc_name}'. Skipping.") else template = Vcloud::Core::VappTemplate.get(vapp_config[:catalog], vapp_config[:catalog_item]) template_id = template.id network_names = extract_vm_networks(vapp_config) vapp = Vcloud::Core::Vapp.instantiate(name, network_names, template_id, vdc_name) Vcloud::Launcher::VmOrchestrator.new(vapp.fog_vms.first, vapp).customize(vapp_config[:vm]) if vapp_config[:vm] end vapp end def self.provision_schema { type: 'hash', required: true, allowed_empty: false, internals: { name: { type: 'string', required: true, allowed_empty: false }, vdc_name: { type: 'string', required: true, allowed_empty: false }, catalog: { type: 'string', required: true, allowed_empty: false }, catalog_item: { type: 'string', required: true, allowed_empty: false }, vm: Vcloud::Launcher::VmOrchestrator.customize_schema, } } end def self.extract_vm_networks(config) if (config[:vm] && config[:vm][:network_connections]) config[:vm][:network_connections].collect { |h| h[:name] } end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems