Class: Kitchen::Driver::Cloud

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/driver/cloud.rb

Class Method Summary collapse

Class Method Details

.compute(config) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/kitchen/driver/cloud.rb', line 7

def self.compute(config)
  server_def = { provider: 'Rackspace' }
  opts = [:version, :rackspace_username, :rackspace_api_key, :rackspace_region]
  opts.each do |opt|
    server_def[opt] = config[opt]
  end
  Fog::Compute.new(server_def)
end

.create_server(instance, config) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/kitchen/driver/cloud.rb', line 16

def self.create_server(instance, config)
  server_def = { name: generate_name(instance), config_drive: true}
  [:image_id, :flavor_id, :personality].each do |opt|
    server_def[opt] = config[opt]
  end
  server_def[:no_passwd_lock] = true
  server = compute(config).servers.new(server_def)
  server.save
  server
end