lib/cucumber/chef/steps/ssh_steps.rb in cucumber-chef-2.1.0.rc.1 vs lib/cucumber/chef/steps/ssh_steps.rb in cucumber-chef-2.1.0.rc.2
- old
+ new
@@ -9,13 +9,13 @@
table.hashes.each do |hash|
id = hash["id"]
@ssh_sessions[id] and !@ssh_sessions[id].closed? and @ssh_sessions[id].close
@ssh_sessions[id] = ZTK::SSH.new
- @ssh_sessions[id].config.proxy_host_name = $test_lab.labs_running.first.public_ip_address
- @ssh_sessions[id].config.proxy_user = "ubuntu"
- @ssh_sessions[id].config.proxy_keys = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{@ssh_sessions[id].config.proxy_user}")
+ @ssh_sessions[id].config.proxy_host_name = $test_lab.ip
+ @ssh_sessions[id].config.proxy_user = Cucumber::Chef.lab_user
+ @ssh_sessions[id].config.proxy_keys = Cucumber::Chef.lab_identity
hash['hostname'] and (@ssh_sessions[id].config.host_name = hash['hostname'])
hash['username'] and (@ssh_sessions[id].config.user = hash['username'])
hash['password'] and (@ssh_sessions[id].config.password = hash['password'])
hash['keyfile'] and (@ssh_sessions[id].config.keys = hash['keyfile'])
@@ -30,17 +30,32 @@
lambda {
@connection and !@connection.ssh.closed? and @connection.ssh.close
@connection = ZTK::SSH.new
- @connection.config.proxy_host_name = $test_lab.labs_running.first.public_ip_address
- @connection.config.proxy_user = "ubuntu"
- @connection.config.proxy_keys = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{@connection.config.proxy_user}")
+ @connection.config.proxy_host_name = $test_lab.ip
+ @connection.config.proxy_port = $test_lab.port
+ @connection.config.proxy_user = Cucumber::Chef.lab_user
+ @connection.config.proxy_keys = Cucumber::Chef.lab_identity
hostname and (@connection.config.host_name = hostname)
- session["username"] and (@connection.config.user = session["username"])
session["password"] and (@connection.config.password = session["password"])
- session["keyfile"] and (@connection.config.keys = session["keyfile"])
+
+ if username = session["username"]
+ if username == "$lxc$"
+ @connection.config.user = Cucumber::Chef.lxc_user
+ else
+ @connection.config.user = username
+ end
+ end
+
+ if keyfile = session["keyfile"]
+ if keyfile == "$lxc$"
+ @connection.config.keys = Cucumber::Chef.lxc_identity
+ else
+ @connection.config.keys = keyfile
+ end
+ end
}.should_not raise_error
end
And /^I run "([^\"]*)"$/ do |command|