Class: Kitchen::Driver::Rax

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Rax

Returns a new instance of Rax.



35
36
37
38
# File 'lib/kitchen/driver/rax.rb', line 35

def initialize(config)
	super
	Fog.timeout = config[:wait_for].to_i
end

Instance Attribute Details

#stateObject

Returns the value of attribute state.



12
13
14
# File 'lib/kitchen/driver/rax.rb', line 12

def state
  @state
end

Instance Method Details

#create(state) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/kitchen/driver/rax.rb', line 40

def create(state)
	info("Creating a new Rackspace instance.")
	server = Kitchen::Driver::Cloud.create_server(instance, config)
	wait_for_build_completion(server, state)
	check_winrm_connectivity(instance, server.public_ip_address, server.password)
rescue Fog::Errors::Error, Excon::Errors::Error => ex
	raise ActionFailed, ex.message
end

#destroy(state) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/kitchen/driver/rax.rb', line 49

def destroy(state)
	return if state[:server_id].nil?
	server = compute.servers.get(state[:server_id])
	server.destroy unless server.nil?
	info("Rackspace instance <#{state[:server_id]}> destroyed.")
	state.delete(:server_id)
	state.delete(:hostname)
end