summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/util/powershell/ps_credential.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/chef/util/powershell/ps_credential.rb b/lib/chef/util/powershell/ps_credential.rb
index 20c2055247..701b3ce685 100644
--- a/lib/chef/util/powershell/ps_credential.rb
+++ b/lib/chef/util/powershell/ps_credential.rb
@@ -22,11 +22,17 @@ class Chef::Util::Powershell
class PSCredential
def initialize(username, password)
@username = username
- @encrypted_password = Chef::ReservedNames::Win32::Crypto.encrypt(password)
+ @password = password
end
def to_psobject
- "New-Object System.Management.Automation.PSCredential('#{@username}',\('#{@encrypted_password}' | ConvertTo-SecureString))"
+ "New-Object System.Management.Automation.PSCredential('#{@username}',('#{encrypt(@password)}' | ConvertTo-SecureString))"
+ end
+
+ private
+
+ def encrypt(str)
+ Chef::ReservedNames::Win32::Crypto.encrypt(str)
end
end
end