summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-01-16 17:45:02 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-01-16 17:45:02 -0800
commit2274ae7f2c5ef6c23e4a8b02f5b677f487a2a0d9 (patch)
tree0bd8d5d384fa41d6157471910110b77f3aadb678 /lib
parent4bffa7d9682170cd940d544ddadc485a8c90c032 (diff)
downloadchef-2274ae7f2c5ef6c23e4a8b02f5b677f487a2a0d9.tar.gz
CHEF-2418: rename ssh_password to ssh_password_ng
- commands like knife bootstrap and knife * server create will not set - can use #has_key? as a test if we're running knife ssh or not - do not prompt for password if ssh_password_ng does not exist - not surfaced in knife.rb still uses old ssh_password config option
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/knife/ssh.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 837710b932..dd392388bc 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -64,12 +64,12 @@ class Chef
:long => "--ssh-user USERNAME",
:description => "The ssh username"
- option :ssh_password,
+ option :ssh_password_ng,
:short => "-P [PASSWORD]",
:long => "--ssh-password [PASSWORD]",
:description => "The ssh password - will prompt if flag is specified but no password is given",
- # default to a value that can not be a password (boolean)
- # so we can effectively test if this parameter was specified
+ # default to a value that can not be a password (boolean)
+ # so we can effectively test if this parameter was specified
# without a vlaue
:default => false
@@ -437,15 +437,20 @@ class Chef
end
def configure_password
- if config[:ssh_password].nil?
+ if config.has_key?(:ssh_password_ng) && config[:ssh_password_ng].nil?
# If the parameter is called on the command line with no value
- # it will set :ssh_password = nil
+ # it will set :ssh_password_ng = nil
# This is where we want to trigger a prompt for password
config[:ssh_password] = get_password
else
+ # if ssh_password_ng is false then it has not been set at all, and we may be in knife ec2 and still
+ # using an old config[:ssh_password]. this is backwards compatibility. all knife cloud plugins should
+ # be updated to use ssh_password_ng with a default of false and ssh_password should be retired, (but
+ # we'll still need to use the ssh_password out of knife.rb if we find that).
+ ssh_password = config.has_key?(:ssh_password_ng) ? config[:ssh_password_ng] : config[:ssh_password]
# Otherwise, the password has either been specified on the command line,
# in knife.rb, or key based auth will be attempted
- config[:ssh_password] = get_stripped_unfrozen_value(config[:ssh_password] ||
+ config[:ssh_password] = get_stripped_unfrozen_value(ssh_password ||
Chef::Config[:knife][:ssh_password])
end
end