Class: ChefMetalFog::Providers::CloudStack
- Defined in:
- lib/chef_metal_fog/providers/cloudstack.rb
Constant Summary
Constants inherited from FogDriver
Class Method Summary collapse
Methods inherited from FogDriver
__new__, #allocate_machine, canonicalize_url, #compute, #compute_options, #connect_to_machine, #destroy_machine, from_provider, from_url, inherited, #initialize, new, #provider, provider_class_for, #ready_machine, register_provider_class, #stop_machine, #transport_for
Constructor Details
This class inherits a constructor from ChefMetalFog::FogDriver
Class Method Details
.compute_options_for(provider, id, config) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/chef_metal_fog/providers/cloudstack.rb', line 7 def self.(provider, id, config) = {} [:provider] = provider new_config = { :driver_options => { :compute_options => }} new_defaults = { :driver_options => { :compute_options => {} }, :machine_options => { :bootstrap_options => {} } } result = Cheffish::MergedConfig.new(new_config, config, new_defaults) if id && id != '' cloudstack_uri = URI.parse(id) [:cloudstack_scheme] = cloudstack_uri.scheme [:cloudstack_host] = cloudstack_uri.host [:cloudstack_port] = cloudstack_uri.port [:cloudstack_path] = cloudstack_uri.path end host = result[:driver_options][:compute_options][:cloudstack_host] path = result[:driver_options][:compute_options][:cloudstack_path] || '/client/api' port = result[:driver_options][:compute_options][:cloudstack_port] || 443 scheme = result[:driver_options][:compute_options][:cloudstack_scheme] || 'https' id = URI.scheme_list[scheme.upcase].build(:host => host, :port => port, :path => path).to_s [result, id] end |