summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-07-02 17:57:11 -0700
committerGitHub <noreply@github.com>2020-07-02 17:57:11 -0700
commit568aa1497824e19a0808b689d6331fe519395fc6 (patch)
treec1dadcf2825ad72856c4db2e99fa7d29e4ef0d10
parent24e595efa966e342ee3c5c999d534a5ee78b7e12 (diff)
parent94d55d7d86b80d5c9538908d380fa17ae2c3abac (diff)
downloadchef-568aa1497824e19a0808b689d6331fe519395fc6.tar.gz
Merge pull request #10107 from chef-davin/windows_security_policy
update to powershell_out to be compatible with 32 bit windows
-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