-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to use ssh agent if no password or key files have been specified #165
Conversation
30ff82c
to
cfffc63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great -- just one question
def ssh_known_identities | ||
return @manager.known_identities if @manager | ||
# Force KeyManager to load the key(s) | ||
@manager = Net::SSH::Authentication::KeyManager.new(nil?).each_identity {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm interesting. Can you fill me in here -- what is nil?
? It seems to resolve to false
,
irb(main):004:0> nil?
=> false
or am I missing something?
cfffc63
to
ac88398
Compare
Thanks Stephan! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see this come in, thank you @alexpop !!
Just one comment
return @manager.known_identities if @manager | ||
# Force KeyManager to load the key(s) | ||
@manager = Net::SSH::Authentication::KeyManager.new(nil).each_identity {} | ||
@manager.known_identities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 3-liner could be simplified to:
@manager ||= Net::SSH...blah
@manager.known_identities
DRY 😉
ac88398
to
7c990bc
Compare
Signed-off-by: Alex Pop <apop@chef.io>
7c990bc
to
0d3702d
Compare
Nice one Dom, rebased and ready to go! |
The Ubuntu suite failing in travis works locally:
|
Awesome work @alexpop |
If no password or private key is specified for ssh connections, try to use the ssh agent keys.
How it works:
This enables tools like InSpec to run remote scans without having to link to a private key or use a password.