Sha256: 4a966069de28448ce68492947119e2165daf85d11b8edf06d911c54c9e3b9b34

Contents?: true

Size: 1.54 KB

Versions: 25

Compression:

Stored size: 1.54 KB

Contents

class Chef
module Provisioning
module FogDriver
  module Providers
    class CloudStack < FogDriver::Driver

      Driver.register_provider_class('CloudStack', FogDriver::Providers::CloudStack)

      def creator
        ''
      end

      def self.compute_options_for(provider, id, config)
        new_compute_options = {}
        new_compute_options[:provider] = provider
        new_config = { :driver_options => { :compute_options => new_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)
          new_compute_options[:cloudstack_scheme] = cloudstack_uri.scheme
          new_compute_options[:cloudstack_host]   = cloudstack_uri.host
          new_compute_options[:cloudstack_port]   = cloudstack_uri.port
          new_compute_options[: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

    end
  end
end
end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
chef-provisioning-fog-0.26.1 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.26.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.25.1 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.25.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.24.1 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.24.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.23.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.22.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.21.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.20.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.19.1 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.19.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.18.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.17.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.16.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.15.3 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.15.2 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.15.1 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.14.0 lib/chef/provisioning/fog_driver/providers/cloudstack.rb
chef-provisioning-fog-0.13.2 lib/chef/provisioning/fog_driver/providers/cloudstack.rb