46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/rspec-system/node_set/openstack.rb', line 46
def connect
nodes.each do |k,v|
server = RSpec.configuration.rs_storage[:nodes][k][:server]
before = Time.new.to_i
while true
begin
server.wait_for(5) { ready? }
break
rescue ::Fog::Errors::TimeoutError
raise if Time.new.to_i - before > vmconf[:node_timeout]
log.info "Timeout connecting to instance, trying again..."
end
end
chan = ssh_connect(:host => k, :user => 'root', :net_ssh_options => {
:keys => vmconf[:ssh_keys].split(':'),
:host_name => server.addresses[vmconf[:network_name]].first['addr'],
:paranoid => false
})
RSpec.configuration.rs_storage[:nodes][k][:ssh] = chan
end
end
|