diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-07-24 14:11:11 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-09-25 18:35:33 -0700 |
commit | 2e1ba1c34920b16c580b0d422aebccc9c82ca178 (patch) | |
tree | 9410d4720bb7280389b88a511edf1ac953b40b49 | |
parent | e1fb23e734ea454c7f46326b215e2006a90fee21 (diff) | |
download | chef-2e1ba1c34920b16c580b0d422aebccc9c82ca178.tar.gz |
Simplify code / avoid mutating config
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/knife/winrm_knife_base.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/chef/knife/winrm_knife_base.rb b/lib/chef/knife/winrm_knife_base.rb index 6cdec2f914..ad9a038e9e 100644 --- a/lib/chef/knife/winrm_knife_base.rb +++ b/lib/chef/knife/winrm_knife_base.rb @@ -212,8 +212,9 @@ class Chef codepage: config[:winrm_codepage], } + # if a username was set and no password set we need to prompt if @session_opts[:user] && @session_opts[:password].nil? - @session_opts[:password] = config[:winrm_password] = get_password + @session_opts[:password] = ui.ask("Enter your password: ", echo: false) end if @session_opts[:transport] == :kerberos @@ -274,10 +275,6 @@ class Chef resolve_winrm_transport != :negotiate end - def get_password - @password ||= ui.ask("Enter your password: ", echo: false) - end - def negotiate_auth? config[:winrm_authentication_protocol] == "negotiate" end |