Skip to content

Commit

Permalink
remove weird sudo related ssh stuff and don't memoize ssh connection
Browse files Browse the repository at this point in the history
  • Loading branch information
geemus committed Oct 20, 2010
1 parent 2c7477a commit 8aec425
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions lib/fog/aws/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ def setup(credentials = {})

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
Expand Down
3 changes: 1 addition & 2 deletions lib/fog/bluebox/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ def setup(credentials = {})

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
Expand Down
3 changes: 1 addition & 2 deletions lib/fog/core/ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ def run(commands)
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
Expand Down
3 changes: 1 addition & 2 deletions lib/fog/rackspace/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ def setup(credentials = {})

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
Expand Down
3 changes: 1 addition & 2 deletions lib/fog/slicehost/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ def setup(credentials = {})

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
Expand Down

0 comments on commit 8aec425

Please sign in to comment.