From 83372d53f5d12d4e1268b7782eef123ca627f9a7 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 5 Feb 2016 10:31:20 -0500 Subject: [PATCH 1/2] Switch to new SSH API This changes the SSH api to use a gateway-enabled wrapper, instead of raw Kitchen::SSH, which does not support ssh gateways. --- lib/kitchen/driver/opennebula.rb | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/kitchen/driver/opennebula.rb b/lib/kitchen/driver/opennebula.rb index 18aebbb..b416ae0 100644 --- a/lib/kitchen/driver/opennebula.rb +++ b/lib/kitchen/driver/opennebula.rb @@ -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 From 346e091ac644af1ac35b9df37c35b6af6f9b2139 Mon Sep 17 00:00:00 2001 From: poliva83 Date: Fri, 5 Feb 2016 13:13:13 -0500 Subject: [PATCH 2/2] Bump version and add CHANGELOG message. --- CHANGELOG.md | 10 +++++++++- lib/kitchen/driver/opennebula_version.rb | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a01994d..6490a0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/kitchen/driver/opennebula_version.rb b/lib/kitchen/driver/opennebula_version.rb index e46ab2f..1bc6e5b 100644 --- a/lib/kitchen/driver/opennebula_version.rb +++ b/lib/kitchen/driver/opennebula_version.rb @@ -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