Last active
December 29, 2015 03:49
-
-
Save inokappa/7610347 to your computer and use it in GitHub Desktop.
test-kitchen-1.0.0.beta.4/lib/kitchen/ssh.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- test-kitchen-1.0.0.beta.4/lib/kitchen/ssh.rb 2013-11-23 12:16:54.270673732 +0900 | |
+++ /var/lib/gems/1.9.1/gems/test-kitchen-1.0.0.beta.4.bk/lib/kitchen/ssh.rb 2013-11-23 12:16:01.318676003 +0900 | |
@@ -37,9 +37,10 @@ | |
# @author Fletcher Nichol <fnichol@nichol.ca> | |
class SSH | |
- def initialize(hostname, username, options = {}) | |
+ def initialize(hostname, port, username, options = {}) | |
@hostname = hostname | |
@username = username | |
+ @port = port | |
@options = options.dup | |
@logger = @options.delete(:logger) || ::Logger.new(STDOUT) | |
@@ -103,7 +104,7 @@ | |
private | |
- attr_reader :hostname, :username, :options, :logger | |
+ attr_reader :hostname, :username, :port, :options, :logger | |
def session | |
@session ||= establish_connection | |
@@ -119,7 +120,7 @@ | |
begin | |
logger.debug("[SSH] opening connection to #{self}") | |
- Net::SSH.start(hostname, username, options) | |
+ Net::SSH.start(hostname, username, port, options) | |
rescue *rescue_exceptions => e | |
if (retries -= 1) > 0 | |
logger.info("[SSH] connection failed, retrying (#{e.inspect})") | |
@@ -135,9 +136,9 @@ | |
"#{username}@#{hostname}:#{port}<#{options.inspect}>" | |
end | |
- def port | |
- options.fetch(:port, 22) | |
- end | |
+ #def port | |
+ # options.fetch(:port, 22) | |
+ #end | |
def exec_with_exit(cmd) | |
exit_code = nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment