Sha256: 261ccef094aa1a1c505b68ec2f2ab6cd54ee0f75d5f40c52ccd49ab289af171f

Contents?: true

Size: 1.32 KB

Versions: 6

Compression:

Stored size: 1.32 KB

Contents

# fog:OpenStack:https://identifyhost:portNumber/v2.0
module ChefMetalFog
  module Providers
    class OpenStack < ChefMetalFog::FogDriver

      ChefMetalFog::FogDriver.register_provider_class('OpenStack', ChefMetalFog::Providers::OpenStack)

      def creator
        compute_options[:openstack_username]
      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)

        new_compute_options[:openstack_auth_url] = id if (id && id != '')
        credential = Fog.credentials

        new_compute_options[:openstack_username] ||= credential[:openstack_username]
        new_compute_options[:openstack_api_key] ||= credential[:openstack_api_key]
        new_compute_options[:openstack_auth_url] ||= credential[:openstack_auth_url]
        new_compute_options[:openstack_tenant] ||= credential[:openstack_tenant]

        id = result[:driver_options][:compute_options][:openstack_auth_url]

        [result, id]
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chef-metal-fog-0.9 lib/chef_metal_fog/providers/openstack.rb
chef-metal-fog-0.8 lib/chef_metal_fog/providers/openstack.rb
chef-metal-fog-0.7.1 lib/chef_metal_fog/providers/openstack.rb
chef-metal-fog-0.7 lib/chef_metal_fog/providers/openstack.rb
chef-metal-fog-0.6.1 lib/chef_metal_fog/providers/openstack.rb
chef-metal-fog-0.6 lib/chef_metal_fog/providers/openstack.rb