summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavin Taddeo <davin@chef.io>2020-07-02 19:24:04 -0400
committerDavin Taddeo <davin@chef.io>2020-07-02 19:24:04 -0400
commit94d55d7d86b80d5c9538908d380fa17ae2c3abac (patch)
treec1dadcf2825ad72856c4db2e99fa7d29e4ef0d10
parent24e595efa966e342ee3c5c999d534a5ee78b7e12 (diff)
downloadchef-94d55d7d86b80d5c9538908d380fa17ae2c3abac.tar.gz
update to powershell_out to be compatible with 32 bit windows
Signed-off-by: Davin Taddeo <davin@chef.io>
-rw-r--r--lib/chef/resource/windows_security_policy.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/resource/windows_security_policy.rb b/lib/chef/resource/windows_security_policy.rb
index 434e21141c..dc89b09bc6 100644
--- a/lib/chef/resource/windows_security_policy.rb
+++ b/lib/chef/resource/windows_security_policy.rb
@@ -81,7 +81,7 @@ class Chef
description: "Policy value to be set for policy name."
load_current_value do |desired|
- output = powershell_exec(<<-CODE).result
+ powershell_code = <<-CODE
C:\\Windows\\System32\\secedit /export /cfg $env:TEMP\\secopts_export.inf | Out-Null
# cspell:disable-next-line
$security_options_data = (Get-Content $env:TEMP\\secopts_export.inf | Select-String -Pattern "^[CEFLMNPR].* =.*$" | Out-String)
@@ -106,9 +106,9 @@ class Chef
LockoutBadCount = $security_options_hash.LockoutBadCount
}) | ConvertTo-Json
CODE
-
- current_value_does_not_exist! if output.empty?
- state = Chef::JSONCompat.from_json(output)
+ output = powershell_out(powershell_code)
+ current_value_does_not_exist! if output.stdout.empty?
+ state = Chef::JSONCompat.from_json(output.stdout)
if desired.secoption == "ResetLockoutCount" || desired.secoption == "LockoutDuration"
if state["LockoutBadCount"] == "0"
@@ -142,7 +142,7 @@ class Chef
Remove-Item $env:TEMP\\#{security_option}_Export.inf -force
EOH
- powershell_exec!(cmd)
+ powershell_out!(cmd)
end
end
end