mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Make :private_key optional in Fog::*::Compute::Server#ssh
Net::SSH can authenticate with the ssh-agent, so a private key is only required if ENV['SSH_AGENT_SOCK'] is not set.
This commit is contained in:
parent
4bfe1a27c7
commit
5694180508
4 changed files with 20 additions and 8 deletions
|
@ -177,8 +177,11 @@ module Fog
|
|||
end
|
||||
|
||||
def ssh(commands)
|
||||
requires :identity, :ip_address, :private_key, :username
|
||||
Fog::SSH.new(ip_address, username, :key_data => [private_key]).run(commands)
|
||||
requires :identity, :ip_address, :username
|
||||
|
||||
options = {}
|
||||
options[:key_data] = [private_key] if private_key
|
||||
Fog::SSH.new(ip_address, username, options).run(commands)
|
||||
end
|
||||
|
||||
def start
|
||||
|
|
|
@ -108,8 +108,11 @@ module Fog
|
|||
end
|
||||
|
||||
def ssh(commands)
|
||||
requires :identity, :ips, :private_key, :username
|
||||
Fog::SSH.new(ips.first['address'], username, :key_data => [private_key]).run(commands)
|
||||
requires :identity, :ips, :username
|
||||
|
||||
options = {}
|
||||
options[:key_data] = [private_key] if private_key
|
||||
Fog::SSH.new(ips.first['address'], username, options).run(commands)
|
||||
end
|
||||
|
||||
def username
|
||||
|
|
|
@ -104,8 +104,11 @@ module Fog
|
|||
end
|
||||
|
||||
def ssh(commands)
|
||||
requires :addresses, :identity, :private_key, :username
|
||||
Fog::SSH.new(addresses['public'].first, username, :key_data => [private_key]).run(commands)
|
||||
requires :addresses, :identity, :username
|
||||
|
||||
options = {}
|
||||
options[:key_data] = [private_key] if private_key
|
||||
Fog::SSH.new(addresses['public'].first, username, options).run(commands)
|
||||
end
|
||||
|
||||
def username
|
||||
|
|
|
@ -94,8 +94,11 @@ module Fog
|
|||
end
|
||||
|
||||
def ssh(commands)
|
||||
requires :addresses, :identity, :private_key, :username
|
||||
Fog::SSH.new(addresses.first, username, :key_data => [private_key]).run(commands)
|
||||
requires :addresses, :identity, :username
|
||||
|
||||
options = {}
|
||||
options[:key_data] = [private_key] if private_key
|
||||
Fog::SSH.new(addresses.first, username, options).run(commands)
|
||||
end
|
||||
|
||||
def username
|
||||
|
|
Loading…
Add table
Reference in a new issue