Skip to content

Commit

Permalink
Merge pull request #10 from test-kitchen/andrewjbrown/ssh_gateway
Browse files Browse the repository at this point in the history
Andrewjbrown/ssh gateway
  • Loading branch information
poliva83 committed Feb 5, 2016
2 parents 583e747 + 346e091 commit 089d953
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.1.0 / Unreleased
## 0.2.0

* Switch SSH api to use gateway-enabled wrapper, instead of raw Kitchen::SSH, which does not support ssh gateways.

## 0.1.2

* Adds an authentication check for OpenNebula, and uses a later version of fog which supports multiple NICs in a VM template.

## 0.1.0

* Initial release
31 changes: 15 additions & 16 deletions lib/kitchen/driver/opennebula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,26 +133,25 @@ def tcp_check(state)
end

def passwordless_sudo_check(state)
wait_for_passwordless_sudo(state) unless config[:no_passwordless_sudo_check]
sleep(config[:no_passwordless_sudo_sleep]) if config[:no_passwordless_sudo_check]
if config[:no_passwordless_sudo_check]
sleep(config[:no_passwordless_sudo_sleep])
else
wait_for_passwordless_sudo(state)
end
debug("Passwordless sudo ready on #{instance.to_str}")
end

def wait_for_passwordless_sudo(state)
Kitchen::SSH.new(*build_ssh_args(state)) do |conn|
retries = config[:passwordless_sudo_timeout] || 300
retry_interval = config[:passwordless_sudo_retry_interval] || 10
begin
logger.info("Waiting #{retries.to_s} seconds for #{config[:username]} user to be granted passwordless sudo on #{state[:hostname]}...")
retries -= retry_interval
run_remote("sudo -n true", conn)
rescue ActionFailed => e
if (e.message.eql? "SSH exited (1) for command: [sudo -n true]") && (retries >= 0)
sleep retry_interval
retry
end
raise ActionFailed, e.message
end
retries = config[:passwordless_sudo_timeout] || 300
retry_interval = config[:passwordless_sudo_retry_interval] || 10
begin
remote_command(state, 'sudo -n true')
rescue Kitchen::Transport::SshFailed => e
if (e.message.eql? "SSH exited (1) for command: [sudo -n true]") && (retries >= 0)
sleep retry_interval
retry
end
raise ActionFailed, e.message
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/kitchen/driver/opennebula_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ module Kitchen
module Driver

# Version string for Opennebula Kitchen driver
OPENNEBULA_VERSION = "0.1.2"
OPENNEBULA_VERSION = "0.2.0"
end
end

0 comments on commit 089d953

Please sign in to comment.