summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2021-02-28 10:21:31 -0800
committerTim Smith <tsmith84@gmail.com>2021-02-28 10:21:31 -0800
commita6589309b868a63b2ae1497171288c7fd5cafd5d (patch)
treef738614dfbfb74af8341541b591a233f6b16a690
parent725705767719b5e7b630171fb876d7f57c9941af (diff)
downloadchef-faster_replacements.tar.gz
Use .tr instead of .gsub where we canfaster_replacements
This is faster if we're not using a regex in the replacement Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/windows_security_policy.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/resource/windows_security_policy.rb b/lib/chef/resource/windows_security_policy.rb
index 980b59a0ca..13af7c8056 100644
--- a/lib/chef/resource/windows_security_policy.rb
+++ b/lib/chef/resource/windows_security_policy.rb
@@ -115,13 +115,13 @@ class Chef
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
- file_path = file.path.gsub("/", '\\')
+ file_path = file.path.tr("/", '\\')
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg #{file_path} /areas SECURITYPOLICY"
else
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
- file_path = file.path.gsub("/", '\\')
+ file_path = file.path.tr("/", '\\')
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg #{file_path} /areas SECURITYPOLICY"
end
shell_out!(cmd)