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

Stop hardcoding the server ssh port.

This commit is contained in:
David Calavera 2013-03-12 16:50:17 +01:00
parent 8116689537
commit 2ab2111a2e

View file

@ -4,7 +4,7 @@ module Fog
module Compute
class Server < Fog::Model
attr_writer :username, :private_key, :private_key_path, :public_key, :public_key_path
attr_writer :username, :private_key, :private_key_path, :public_key, :public_key_path, :ssh_port
def username
@username ||= 'root'
@ -28,6 +28,9 @@ module Fog
@public_key ||= public_key_path && File.read(public_key_path)
end
def ssh_port
@ssh_port ||= 22
end
def scp(local_path, remote_path, upload_options = {})
require 'net/scp'
@ -58,10 +61,6 @@ module Fog
Fog::SSH.new(public_ip_address, username, options).run(commands, &blk)
end
def ssh_port
22
end
def sshable?(options={})
ready? && !public_ip_address.nil? && !!Timeout::timeout(8) { ssh('pwd', options) }
rescue SystemCallError, Net::SSH::AuthenticationFailed, Timeout::Error