57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/kitchen/driver/openstack.rb', line 57
def create(state)
config[:server_name] ||= generate_name(instance.name)
config[:disable_ssl_validation] and disable_ssl_validation
server = create_server
state[:server_id] = server.id
info "OpenStack instance <#{state[:server_id]}> created."
server.wait_for { print '.'; ready? } ; info "\n(server ready)"
if config[:floating_ip_pool]
attach_ip_from_pool(server, config[:floating_ip_pool])
elsif config[:floating_ip]
attach_ip(server, config[:floating_ip])
end
state[:hostname] = get_ip(server)
state[:ssh_key] = config[:private_key_path]
wait_for_sshd(state[:hostname], config[:username],
{ :port => config[:port] }) ; info '(ssh ready)'
if config[:key_name]
info "Using OpenStack keypair <#{config[:key_name]}>"
end
info "Using public SSH key <#{config[:public_key_path]}>"
info "Using private SSH key <#{config[:private_key_path]}>"
unless config[:key_name]
do_ssh_setup(state, config, server)
end
rescue Fog::Errors::Error, Excon::Errors::Error => ex
raise ActionFailed, ex.message
end
|