1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Add ssh_port to Fog::Compute::Server

This is for when a server may not be listening for ssh on port 22
This commit is contained in:
Edward Muller 2012-06-21 14:56:12 -07:00
parent c2ed3c886d
commit f1a64268b5

View file

@ -12,7 +12,7 @@ module Fog
require 'net/scp'
requires :public_ip_address, :username
scp_options = {}
scp_options = {:port => ssh_port}
scp_options[:key_data] = [private_key] if private_key
Fog::SCP.new(public_ip_address, username, scp_options).upload(local_path, remote_path, upload_options)
end
@ -23,7 +23,7 @@ module Fog
require 'net/scp'
requires :public_ip_address, :username
scp_options = {}
scp_options = {:port => ssh_port}
scp_options[:key_data] = [private_key] if private_key
Fog::SCP.new(public_ip_address, username, scp_options).download(remote_path, local_path, download_options)
end
@ -33,9 +33,14 @@ module Fog
requires :public_ip_address, :username
options[:key_data] = [private_key] if private_key
options[:port] ||= ssh_port
Fog::SSH.new(public_ip_address, username, options).run(commands, &blk)
end
def ssh_port
22
end
def sshable?
ready? && !public_ip_address.nil? && !!Timeout::timeout(8) { ssh 'pwd' }
rescue SystemCallError, Net::SSH::AuthenticationFailed, Timeout::Error