mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Make :key_data, :keys and :password optional in Fog::SSH.new
Net::SSH 2.0 will automatically authenticate with ssh-agent if it's running, so a key or password is only required if ENV['SSH_AUTH_SOCK'] is not set. See https://github.com/net-ssh/net-ssh/blob/v2.0.0/lib/net/ssh/authentication/key_manager.rb#L20-23
This commit is contained in:
parent
e53fffeb28
commit
4bfe1a27c7
1 changed files with 2 additions and 2 deletions
|
@ -2,8 +2,8 @@ module Fog
|
|||
module SSH
|
||||
|
||||
def self.new(address, username, options = {})
|
||||
unless options[:key_data] || options[:keys] || options[:password]
|
||||
raise ArgumentError.new(':key_data, :keys or :password are required to initialize SSH')
|
||||
unless options[:key_data] || options[:keys] || options[:password] || ENV['SSH_AUTH_SOCK']
|
||||
raise ArgumentError.new(':key_data, :keys, :password or ENV[\'SSH_AUTH_SOCK\'] are required to initialize SSH')
|
||||
end
|
||||
if Fog.mocking?
|
||||
Fog::SSH::Mock.new(address, username, options)
|
||||
|
|
Loading…
Reference in a new issue