summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChibuikem Amaechi <cramaechi@me.com>2018-02-01 12:57:35 -0600
committerChibuikem Amaechi <cramaechi@me.com>2018-02-01 13:24:26 -0600
commit6a6e7d351693d71670f2c06869b4481b4db7bc24 (patch)
treea0354ebe4ee761c4c80406737e7cb78ab944b80b
parentb8f62c1cdc6566252ae70696ee9d93deebb7116b (diff)
downloadchef-6a6e7d351693d71670f2c06869b4481b4db7bc24.tar.gz
Ignore user SSH key authentication if password is given
Signed-off-by: Chibuikem Amaechi <cramaechi@me.com>
-rw-r--r--lib/chef/knife/ssh.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index f8e630603c..885ebc4faa 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -560,11 +560,6 @@ class Chef
config[:ssh_password] = get_stripped_unfrozen_value(ssh_password ||
Chef::Config[:knife][:ssh_password])
end
-
- # CHEF-4342 Diable host key verification if a password has been given.
- if config[:ssh_password]
- config[:host_key_verify] = false
- end
end
def configure_ssh_identity_file
@@ -581,8 +576,13 @@ class Chef
configure_user
configure_password
@password = config[:ssh_password] if config[:ssh_password]
- configure_ssh_identity_file
- configure_ssh_gateway_identity
+
+ # If a password was not given, check for SSH identity file.
+ if !@password
+ configure_ssh_identity_file
+ configure_ssh_gateway_identity
+ end
+
configure_gateway
configure_session