mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
remove weird sudo related ssh stuff and don't memoize ssh connection
This commit is contained in:
parent
2c7477a9e2
commit
8aec42583e
5 changed files with 5 additions and 10 deletions
|
@ -182,8 +182,7 @@ module Fog
|
|||
|
||||
def ssh(commands)
|
||||
requires :identity, :ip_address, :private_key, :username
|
||||
@ssh ||= Fog::SSH.new(ip_address, username, :key_data => [private_key])
|
||||
@ssh.run(commands)
|
||||
Fog::SSH.new(ip_address, username, :key_data => [private_key]).run(commands)
|
||||
end
|
||||
|
||||
def start
|
||||
|
|
|
@ -109,8 +109,7 @@ module Fog
|
|||
|
||||
def ssh(commands)
|
||||
requires :identity, :ips, :private_key, :username
|
||||
@ssh ||= Fog::SSH.new(ips.first['address'], username, :key_data => [private_key])
|
||||
@ssh.run(commands)
|
||||
Fog::SSH.new(ips.first['address'], username, :key_data => [private_key]).run(commands)
|
||||
end
|
||||
|
||||
def username
|
||||
|
|
|
@ -51,8 +51,7 @@ module Fog
|
|||
begin
|
||||
Net::SSH.start(@address, @username, @options) do |ssh|
|
||||
commands.each do |command|
|
||||
sudoable_command = command.sub(/^sudo/, %{sudo -p 'fog sudo password:'})
|
||||
escaped_command = sudoable_command.sub(/'/, %{'"'"'})
|
||||
escaped_command = command.sub(/'/, %{'"'"'})
|
||||
result = Result.new(escaped_command)
|
||||
ssh.open_channel do |ssh_channel|
|
||||
ssh_channel.request_pty
|
||||
|
|
|
@ -105,8 +105,7 @@ module Fog
|
|||
|
||||
def ssh(commands)
|
||||
requires :addresses, :identity, :private_key, :username
|
||||
@ssh ||= Fog::SSH.new(addresses['public'].first, username, :key_data => [private_key])
|
||||
@ssh.run(commands)
|
||||
Fog::SSH.new(addresses['public'].first, username, :key_data => [private_key]).run(commands)
|
||||
end
|
||||
|
||||
def username
|
||||
|
|
|
@ -95,8 +95,7 @@ module Fog
|
|||
|
||||
def ssh(commands)
|
||||
requires :addresses, :identity, :private_key, :username
|
||||
@ssh ||= Fog::SSH.new(addresses.first, username, :key_data => [private_key])
|
||||
@ssh.run(commands)
|
||||
Fog::SSH.new(addresses.first, username, :key_data => [private_key]).run(commands)
|
||||
end
|
||||
|
||||
def username
|
||||
|
|
Loading…
Add table
Reference in a new issue