mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #1655 from calavera/fix_server_ssh_port
Stop hardcoding the server's ssh port.
This commit is contained in:
commit
6125b122bd
1 changed files with 4 additions and 5 deletions
|
@ -4,7 +4,7 @@ module Fog
|
||||||
module Compute
|
module Compute
|
||||||
class Server < Fog::Model
|
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
|
def username
|
||||||
@username ||= 'root'
|
@username ||= 'root'
|
||||||
|
@ -28,6 +28,9 @@ module Fog
|
||||||
@public_key ||= public_key_path && File.read(public_key_path)
|
@public_key ||= public_key_path && File.read(public_key_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ssh_port
|
||||||
|
@ssh_port ||= 22
|
||||||
|
end
|
||||||
|
|
||||||
def scp(local_path, remote_path, upload_options = {})
|
def scp(local_path, remote_path, upload_options = {})
|
||||||
require 'net/scp'
|
require 'net/scp'
|
||||||
|
@ -58,10 +61,6 @@ module Fog
|
||||||
Fog::SSH.new(public_ip_address, username, options).run(commands, &blk)
|
Fog::SSH.new(public_ip_address, username, options).run(commands, &blk)
|
||||||
end
|
end
|
||||||
|
|
||||||
def ssh_port
|
|
||||||
22
|
|
||||||
end
|
|
||||||
|
|
||||||
def sshable?(options={})
|
def sshable?(options={})
|
||||||
ready? && !public_ip_address.nil? && !!Timeout::timeout(8) { ssh('pwd', options) }
|
ready? && !public_ip_address.nil? && !!Timeout::timeout(8) { ssh('pwd', options) }
|
||||||
rescue SystemCallError, Net::SSH::AuthenticationFailed, Timeout::Error
|
rescue SystemCallError, Net::SSH::AuthenticationFailed, Timeout::Error
|
||||||
|
|
Loading…
Add table
Reference in a new issue