summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavin Taddeo <davin@chef.io>2020-12-14 08:06:07 -0500
committerDavin Taddeo <davin@chef.io>2020-12-14 08:06:07 -0500
commit9c5ae43f3dcb9b80115cce019f3bc403536fab5f (patch)
tree12969e9c6d1685fa2e2808ceb6cc93656afc9111 /lib
parent590761992be069b5dad670c915ff3d1547f3ca96 (diff)
downloadchef-9c5ae43f3dcb9b80115cce019f3bc403536fab5f.tar.gz
taking suggestions from @phiggins into the code.
Signed-off-by: Davin Taddeo <davin@chef.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/resource/windows_security_policy.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/chef/resource/windows_security_policy.rb b/lib/chef/resource/windows_security_policy.rb
index 2c1fcd84bd..bf1999bc47 100644
--- a/lib/chef/resource/windows_security_policy.rb
+++ b/lib/chef/resource/windows_security_policy.rb
@@ -108,13 +108,14 @@ class Chef
security_value = new_resource.secvalue
file = Tempfile.new(["#{security_option}", ".inf"])
- if security_option == "LockoutBadCount"
- cmd = "net accounts /lockoutthreshold:#{security_value}"
- elsif security_option == "ResetLockoutCount"
- cmd = "net accounts /lockoutwindow:#{security_value}"
- elsif security_option == "LockoutDuration"
- cmd = "net accounts /lockoutduration:#{security_value}"
- elsif security_option == "NewAdministratorName" || security_option == "NewGuestName"
+ case security_option
+ when "LockoutBadCount"
+ cmd = "net accounts /LockoutThreshold:#{security_value}"
+ when "ResetLockoutCount"
+ cmd = "net accounts /LockoutWindow:#{security_value}"
+ when "LockoutDuration"
+ cmd = "net accounts /LockoutDuration:#{security_value}"
+ when "NewAdministratorName", "NewGuestName"
policy_line = "#{security_option} = \"#{security_value}\""
file.write("[Unicode]\r\nUnicode=yes\r\n[System Access]\r\n#{policy_line}\r\n[Version]\r\nsignature=\"$CHICAGO$\"\r\nRevision=1\r\n")
file.close