Class: Kitchen::Driver::Bluebox

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

Overview

Blue Box blocks API driver for Test Kitchen.

Author:

Instance Method Summary collapse

Instance Method Details

#create(state) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/kitchen/driver/bluebox.rb', line 41

def create(state)
  server = create_server
  state[:block_id] = server.id
  state[:hostname] = server.ips.first['address']

  info("Blocks instance <#{state[:block_id]}> created.")
  server.wait_for { print "."; ready? } ; print "(server ready)"
  wait_for_sshd(state[:hostname])       ; print "(ssh ready)\n"
rescue Fog::Errors::Error, Excon::Errors::Error => ex
  raise ActionFailed, ex.message
end

#destroy(state) ⇒ Object



53
54
55
56
57
58
59
60
61
62
# File 'lib/kitchen/driver/bluebox.rb', line 53

def destroy(state)
  return if state[:block_id].nil?

  connection.destroy_block(state[:block_id])
  update_state_for_destroy(state)
rescue Fog::Compute::Bluebox::NotFound
  update_state_for_destroy(state)
rescue Fog::Errors::Error, Excon::Errors::Error => ex
  raise ActionFailed, ex.message
end