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:
parent
8116689537
commit
2ab2111a2e
1 changed files with 4 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue