From cc120b5e899553ef34cfce0882586c13505e11aa Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 15 Aug 2016 20:42:25 -0700 Subject: fix problem with loading .ssh/config --- lib/leap_cli/ssh/remote_command.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/leap_cli') diff --git a/lib/leap_cli/ssh/remote_command.rb b/lib/leap_cli/ssh/remote_command.rb index 3ba86740..7195405e 100644 --- a/lib/leap_cli/ssh/remote_command.rb +++ b/lib/leap_cli/ssh/remote_command.rb @@ -96,10 +96,18 @@ module LeapCli raise ArgumentError, "I don't understand the type of argument `nodes`" end list.collect do |node| + options = SSH::Options.node_options(node, ssh_options_override) + user = options.delete(:user) || 'root' + # + # note: whatever hostname is specified here will be what is used + # when loading options from .ssh/config. However, this value + # has no impact on the actual ip address that is connected to, + # which is determined by the :host_name value in ssh_options. + # SSHKit::Host.new( - :hostname => node.name, - :user => 'root', - :ssh_options => SSH::Options.node_options(node, ssh_options_override) + :hostname => node.domain.full, + :user => user, + :ssh_options => options ) end end -- cgit v1.2.3