Class: Chef::Provisioning::FogDriver::Providers::Rackspace

Inherits:
Driver
  • Object
show all
Defined in:
lib/chef/provisioning/fog_driver/providers/rackspace.rb

Constant Summary

Constants inherited from Driver

Driver::DEFAULT_OPTIONS, Driver::RETRYABLE_ERRORS, Driver::RETRYABLE_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Driver

__new__, #allocate_machine, #allocate_machines, canonicalize_url, #compute, #compute_options, #connect_to_machine, #create_volume, #destroy_machine, #destroy_volume, from_provider, from_url, #image_for, inherited, #initialize, new, #provider, provider_class_for, #ready_machine, register_provider_class, #stop_machine, #transport_for

Constructor Details

This class inherits a constructor from Chef::Provisioning::FogDriver::Driver

Class Method Details

.compute_options_for(provider, id, config) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/chef/provisioning/fog_driver/providers/rackspace.rb', line 19

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[:rackspace_auth_url] = id if id && id != ""
  credential = Fog.credentials

  new_compute_options[:rackspace_username] ||= credential[:rackspace_username]
  new_compute_options[:rackspace_api_key] ||= credential[:rackspace_api_key]
  new_compute_options[:rackspace_auth_url] ||= credential[:rackspace_auth_url]
  new_compute_options[:rackspace_region] ||= credential[:rackspace_region]
  new_compute_options[:rackspace_endpoint] ||= credential[:rackspace_endpoint]

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

  [result, id]
end

Instance Method Details

#convergence_strategy_for(machine_spec, machine_options) ⇒ Object



13
14
15
16
17
# File 'lib/chef/provisioning/fog_driver/providers/rackspace.rb', line 13

def convergence_strategy_for(machine_spec, machine_options)
  machine_options = Cheffish::MergedConfig.new(machine_options,
                                               convergence_options: { ohai_hints: { "rackspace" => {} } })
  super(machine_spec, machine_options)
end

#creatorObject



9
10
11
# File 'lib/chef/provisioning/fog_driver/providers/rackspace.rb', line 9

def creator
  compute_options[:rackspace_username]
end