Class: Chef::Provisioning::FogDriver::Providers::Joyent

Inherits:
Driver
  • Object
show all
Defined in:
lib/chef/provisioning/fog_driver/providers/joyent.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



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/chef/provisioning/fog_driver/providers/joyent.rb', line 33

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

  new_compute_options[:joyent_username] ||= credential[:joyent_username]
  new_compute_options[:joyent_password] ||= credential[:joyent_password]
  new_compute_options[:joyent_keyname] ||= credential[:joyent_keyname]
  new_compute_options[:joyent_keyfile] ||= credential[:joyent_keyfile]
  new_compute_options[:joyent_url] ||= credential[:joyent_url]
  new_compute_options[:joyent_version] ||= credential[:joyent_version]

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

  [result, id]
end

Instance Method Details

#bootstrap_options_for(machine_spec, machine_options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/chef/provisioning/fog_driver/providers/joyent.rb', line 15

def bootstrap_options_for(machine_spec, machine_options)
  bootstrap_options = symbolize_keys(machine_options[:bootstrap_options] || {})

  bootstrap_options[:tags] = default_tags(machine_spec, bootstrap_options[:tags] || {})

  bootstrap_options[:tags].each do |key, val|
    bootstrap_options["tag.#{key}"] = val
  end

  bootstrap_options[:name] ||= machine_spec.name

  bootstrap_options
end

#creatorObject



11
12
13
# File 'lib/chef/provisioning/fog_driver/providers/joyent.rb', line 11

def creator
  compute_options[:joyent_username]
end

#find_floating_ips(_server, _action_handler) ⇒ Object



29
30
31
# File 'lib/chef/provisioning/fog_driver/providers/joyent.rb', line 29

def find_floating_ips(_server, _action_handler)
  []
end