Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Pass an optional identity file through to SSH #6

Merged
merged 1 commit into from

2 participants

@dukedave

No description provided.

@wbailey wbailey merged commit a49e1a7 into wbailey:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 31, 2012
  1. @dukedave
This page is out of date. Refresh to see the latest.
View
4 lib/claws/command/ec2.rb
@@ -33,7 +33,9 @@ def self.exec(options)
puts 'connecting to server...'
- system "ssh #{config.ssh.user}@#{instances[selection.to_i].dns_name}"
+ identity = config.ssh.identity.nil? ? '' : "-i #{config.ssh.identity} "
+
+ system "ssh #{identity}#{config.ssh.user}@#{instances[selection.to_i].dns_name}"
end
end
end
View
1  lib/claws/command/initialize.rb
@@ -10,6 +10,7 @@ def self.exec
},
'ssh' => {
'user' => nil,
+ 'identity' => nil,
},
'aws' => {
'access_key_id' => nil,
View
10 spec/command/ec2_spec.rb
@@ -102,7 +102,9 @@
OpenStruct.new(
{
:ssh => OpenStruct.new(
- { :user => 'test' }
+ { :user => 'test',
+ :identity => 'my_id'
+ }
),
:ec2 => OpenStruct.new(
:fields => {
@@ -130,7 +132,7 @@
)
subject.should_receive(:puts).twice
- subject.should_receive(:system).with('ssh test@test.com').and_return(0)
+ subject.should_receive(:system).with('ssh -i my_id test@test.com').and_return(0)
capture_stdout {
subject.exec options
@@ -153,7 +155,7 @@
)
subject.should_receive(:puts).twice
- subject.should_receive(:system).with('ssh test@test2.com').and_return(0)
+ subject.should_receive(:system).with('ssh -i my_id test@test2.com').and_return(0)
capture_stdout {
subject.exec OpenStruct.new( {:selection => 1, :config_file => nil, :connect => true} )
@@ -168,7 +170,7 @@
subject.should_receive(:gets).and_return('1\n')
subject.should_receive(:puts).once
- subject.should_receive(:system).with('ssh test@test2.com').and_return(0)
+ subject.should_receive(:system).with('ssh -i my_id test@test2.com').and_return(0)
capture_stdout {
subject.exec options
Something went wrong with that request. Please try again.