Class: VagrantPlugins::VCloud::Driver::Meta
- Extended by:
- Forwardable
- Defined in:
- lib/vagrant-vcloud/driver/meta.rb
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
Instance Method Summary collapse
-
#initialize(hostname, username, password, org_name) ⇒ Meta
constructor
A new instance of Meta.
Methods inherited from Base
#compose_vapp_from_vm, #create_vapp_from_template, #delete_vapp, #get_catalog, #get_catalog_by_name, #get_catalog_id_by_name, #get_catalog_item, #get_catalog_item_by_name, #get_organization, #get_organization_by_name, #get_organization_id_by_name, #get_organizations, #get_task, #get_vapp, #get_vapp_edge_public_ip, #get_vapp_port_forwarding_rules, #get_vapp_template, #get_vdc, #get_vdc_by_name, #get_vdc_id_by_name, #get_vm, #login, #logout, #poweron_vapp, #reboot_vapp, #reset_vapp, #set_vapp_network_config, #set_vapp_port_forwarding_rules, #set_vm_guest_customization, #set_vm_hardware, #set_vm_network_config, #suspend_vapp, #upload_ovf, #wait_task_completion
Constructor Details
#initialize(hostname, username, password, org_name) ⇒ Meta
Returns a new instance of Meta.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/vagrant-vcloud/driver/meta.rb', line 33 def initialize(hostname, username, password, org_name) # Setup the base super() @logger = Log4r::Logger.new('vagrant::provider::vcloud::meta') @hostname = hostname @username = username @password = password @org_name = org_name # Read and assign the version of vCloud we know which # specific driver to instantiate. @version = get_api_version(@hostname) || '' # Instantiate the proper version driver for vCloud @logger.debug("Finding driver for vCloud version: #{@version}") driver_map = { '5.1' => Version_5_1, '5.5' => Version_5_1, # Binding vCloud 5.5 API on our current 5.1 implementation '5.6' => Version_5_1, # Binding vCHS API on our current 5.1 implementation '5.7' => Version_5_1 # Binding vCHS API on our current 5.1 implementation } if @version.start_with?('0.9') || @version.start_with?('1.0') || @version.start_with?('1.5') # We only support vCloud Director 5.1 or higher. raise Errors::VCloudOldVersion, :version => @version end driver_klass = nil driver_map.each do |key, klass| if @version.start_with?(key) driver_klass = klass break end end if !driver_klass supported_versions = driver_map.keys.sort.join(', ') raise Errors::VCloudInvalidVersion, :supported_versions => supported_versions end @logger.info("Using vCloud driver: #{driver_klass}") @driver = driver_klass.new(@hostname, @username, @password, @org_name) end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
31 32 33 |
# File 'lib/vagrant-vcloud/driver/meta.rb', line 31 def driver @driver end |