summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2021-10-22 12:15:33 -0700
committerTim Smith <tsmith84@gmail.com>2021-10-22 12:15:33 -0700
commitc8c5b3b41e42c43117256798094f95d3412029bb (patch)
tree46cef0c9c6bae1bbb0b914a0492408436af4be34
parent19c40fe13fe61ea7e5aff0fa17e8627100ef075c (diff)
downloadchef-expeditor/chef/chefstyle_b5c712d298e240493020b8d5977f03172cc65e17.tar.gz
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--chef-config/lib/chef-config/fips.rb2
-rw-r--r--chef-config/lib/chef-config/path_helper.rb2
-rw-r--r--chef-config/spec/unit/fips_spec.rb2
-rw-r--r--chef-config/spec/unit/path_helper_spec.rb32
-rw-r--r--chef-utils/spec/unit/dsl/path_sanity_spec.rb2
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/_openssl.rb2
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/_windows_defender.rb2
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/windows.rb2
-rw-r--r--kitchen-tests/test/integration/end-to-end/habitat_win_config/default_spec.rb4
-rw-r--r--kitchen-tests/test/integration/end-to-end/habitat_win_package/default_spec.rb8
-rw-r--r--kitchen-tests/test/integration/end-to-end/habitat_win_service/default_spec.rb6
-rw-r--r--kitchen-tests/test/integration/end-to-end/habitat_win_sup/default_spec.rb2
-rw-r--r--kitchen-tests/test/integration/end-to-end/habitat_win_sup_toml_config/default_spec.rb2
-rw-r--r--kitchen-tests/test/integration/end-to-end/habitat_win_user_toml/default_spec.rb2
-rw-r--r--lib/chef/chef_fs/file_pattern.rb2
-rw-r--r--lib/chef/chef_fs/path_utils.rb2
-rw-r--r--lib/chef/dsl/reboot_pending.rb2
-rw-r--r--lib/chef/provider/git.rb2
-rw-r--r--lib/chef/provider/ifconfig/debian.rb2
-rw-r--r--lib/chef/resource/habitat_install.rb6
-rw-r--r--lib/chef/resource/inspec_waiver.rb2
-rw-r--r--lib/chef/resource/inspec_waiver_file_entry.rb2
-rw-r--r--lib/chef/resource/windows_auto_run.rb2
-rw-r--r--lib/chef/resource/windows_dfs_namespace.rb4
-rw-r--r--lib/chef/resource/windows_update_settings.rb6
-rw-r--r--spec/functional/dsl/reboot_pending_spec.rb6
-rw-r--r--spec/functional/dsl/registry_helper_spec.rb2
-rw-r--r--spec/functional/resource/dsc_script_spec.rb4
-rw-r--r--spec/functional/resource/registry_spec.rb162
-rw-r--r--spec/functional/win32/registry_spec.rb16
-rw-r--r--spec/unit/dsl/reboot_pending_spec.rb2
-rw-r--r--spec/unit/mixin/default_paths_spec.rb2
-rw-r--r--spec/unit/mixin/securable_spec.rb6
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb10
-rw-r--r--spec/unit/provider/package/windows_spec.rb2
-rw-r--r--spec/unit/provider/registry_key_spec.rb8
-rw-r--r--spec/unit/provider/service/windows_spec.rb10
-rw-r--r--spec/unit/provider/windows_env_spec.rb2
-rw-r--r--spec/unit/provider/zypper_repository_spec.rb2
-rw-r--r--spec/unit/resource/chocolatey_config_spec.rb2
-rw-r--r--spec/unit/resource/chocolatey_feature_spec.rb2
-rw-r--r--spec/unit/resource/chocolatey_source_spec.rb2
-rw-r--r--spec/unit/resource/registry_key_spec.rb20
-rw-r--r--spec/unit/resource/windows_auto_run_spec.rb2
-rw-r--r--spec/unit/resource/windows_feature_powershell_spec.rb2
-rw-r--r--spec/unit/resource/windows_firewall_rule_spec.rb4
-rw-r--r--spec/unit/resource/windows_task_spec.rb6
-rw-r--r--spec/unit/resource_reporter_spec.rb4
-rw-r--r--spec/unit/util/backup_spec.rb2
-rw-r--r--spec/unit/win32/registry_spec.rb6
50 files changed, 194 insertions, 194 deletions
diff --git a/chef-config/lib/chef-config/fips.rb b/chef-config/lib/chef-config/fips.rb
index eb9e55afe6..18bd3f512e 100644
--- a/chef-config/lib/chef-config/fips.rb
+++ b/chef-config/lib/chef-config/fips.rb
@@ -39,7 +39,7 @@ module ChefConfig
Win32::Registry::KEY_READ
end
begin
- Win32::Registry::HKEY_LOCAL_MACHINE.open('System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy', reg_type) do |policy|
+ Win32::Registry::HKEY_LOCAL_MACHINE.open("System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy", reg_type) do |policy|
policy["Enabled"] != 0
end
rescue Win32::Registry::Error
diff --git a/chef-config/lib/chef-config/path_helper.rb b/chef-config/lib/chef-config/path_helper.rb
index adacade391..734dc35635 100644
--- a/chef-config/lib/chef-config/path_helper.rb
+++ b/chef-config/lib/chef-config/path_helper.rb
@@ -335,7 +335,7 @@ module ChefConfig
line.scan(/\s*(?>([^\s\\"]+|"([^"]*)"|'([^']*)')|(\S))(\s|\z)?/m) do |word, within_dq, within_sq, esc, sep|
# Append the string with Word & Escape Character
- field << (word || esc.gsub(/\\(.)/, '\\1'))
+ field << (word || esc.gsub(/\\(.)/, "\\1"))
# Re-build the field when any whitespace character or
# End of string is encountered
diff --git a/chef-config/spec/unit/fips_spec.rb b/chef-config/spec/unit/fips_spec.rb
index 4be6f64a2d..dd8b3e17d1 100644
--- a/chef-config/spec/unit/fips_spec.rb
+++ b/chef-config/spec/unit/fips_spec.rb
@@ -65,7 +65,7 @@ RSpec.describe "ChefConfig.fips?" do
end
context "on windows", :windows_only do
- let(:fips_key) { 'System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy' }
+ let(:fips_key) { "System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy" }
let(:win_reg_entry) { { "Enabled" => enabled } }
before(:each) do
diff --git a/chef-config/spec/unit/path_helper_spec.rb b/chef-config/spec/unit/path_helper_spec.rb
index de45de2a62..70998423d8 100644
--- a/chef-config/spec/unit/path_helper_spec.rb
+++ b/chef-config/spec/unit/path_helper_spec.rb
@@ -62,31 +62,31 @@ RSpec.describe ChefConfig::PathHelper do
context "platform-specific #join behavior" do
it "joins components on Windows when some end with unix separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo/', "bar", "baz", windows: true)).to eq(expected)
+ expect(path_helper.join("C:\\foo/", "bar", "baz", windows: true)).to eq(expected)
end
it "joins components when some end with separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo\\', "bar", "baz", windows: true)).to eq(expected)
+ expect(path_helper.join("C:\\foo\\", "bar", "baz", windows: true)).to eq(expected)
end
it "joins components when some end and start with separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo\\', "bar/", "/baz", windows: true)).to eq(expected)
+ expect(path_helper.join("C:\\foo\\", "bar/", "/baz", windows: true)).to eq(expected)
end
it "joins components that don't end in separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo', "bar", "baz", windows: true)).to eq(expected)
+ expect(path_helper.join("C:\\foo", "bar", "baz", windows: true)).to eq(expected)
end
end
it "cleanpath changes slashes into backslashes and leaves backslashes alone" do
- expect(path_helper.cleanpath('/a/b\\c/d/', windows: true)).to eq('\\a\\b\\c\\d')
+ expect(path_helper.cleanpath("/a/b\\c/d/", windows: true)).to eq("\\a\\b\\c\\d")
end
it "cleanpath does not remove leading double backslash" do
- expect(path_helper.cleanpath('\\\\a/b\\c/d/', windows: true)).to eq('\\\\a\\b\\c\\d')
+ expect(path_helper.cleanpath("\\\\a/b\\c/d/", windows: true)).to eq("\\\\a\\b\\c\\d")
end
end
@@ -117,11 +117,11 @@ RSpec.describe ChefConfig::PathHelper do
end
it "cleanpath changes backslashes into slashes and leaves slashes alone" do
- expect(path_helper.cleanpath('/a/b\\c/d/', windows: false)).to eq("/a/b/c/d")
+ expect(path_helper.cleanpath("/a/b\\c/d/", windows: false)).to eq("/a/b/c/d")
end
it "cleanpath does not remove leading double backslash" do
- expect(path_helper.cleanpath('\\\\a/b\\c/d/', windows: false)).to eq("//a/b/c/d")
+ expect(path_helper.cleanpath("\\\\a/b\\c/d/", windows: false)).to eq("//a/b/c/d")
end
end
end
@@ -139,31 +139,31 @@ RSpec.describe ChefConfig::PathHelper do
context "platform-specific #join behavior" do
it "joins components on Windows when some end with unix separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo/', "bar", "baz")).to eq(expected)
+ expect(path_helper.join("C:\\foo/", "bar", "baz")).to eq(expected)
end
it "joins components when some end with separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo\\', "bar", "baz")).to eq(expected)
+ expect(path_helper.join("C:\\foo\\", "bar", "baz")).to eq(expected)
end
it "joins components when some end and start with separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo\\', "bar/", "/baz")).to eq(expected)
+ expect(path_helper.join("C:\\foo\\", "bar/", "/baz")).to eq(expected)
end
it "joins components that don't end in separators" do
expected = "C:\\foo\\bar\\baz"
- expect(path_helper.join('C:\\foo', "bar", "baz")).to eq(expected)
+ expect(path_helper.join("C:\\foo", "bar", "baz")).to eq(expected)
end
end
it "cleanpath changes slashes into backslashes and leaves backslashes alone" do
- expect(path_helper.cleanpath('/a/b\\c/d/')).to eq('\\a\\b\\c\\d')
+ expect(path_helper.cleanpath("/a/b\\c/d/")).to eq("\\a\\b\\c\\d")
end
it "cleanpath does not remove leading double backslash" do
- expect(path_helper.cleanpath('\\\\a/b\\c/d/')).to eq('\\\\a\\b\\c\\d')
+ expect(path_helper.cleanpath("\\\\a/b\\c/d/")).to eq("\\\\a\\b\\c\\d")
end
end
@@ -198,12 +198,12 @@ RSpec.describe ChefConfig::PathHelper do
end
it "cleanpath changes backslashes into slashes and leaves slashes alone" do
- expect(path_helper.cleanpath('/a/b\\c/d/', windows: false)).to eq("/a/b/c/d")
+ expect(path_helper.cleanpath("/a/b\\c/d/", windows: false)).to eq("/a/b/c/d")
end
# NOTE: this seems a bit weird to me, but this is just the way Pathname#cleanpath works
it "cleanpath does not remove leading double backslash" do
- expect(path_helper.cleanpath('\\\\a/b\\c/d/')).to eq("//a/b/c/d")
+ expect(path_helper.cleanpath("\\\\a/b\\c/d/")).to eq("//a/b/c/d")
end
end
diff --git a/chef-utils/spec/unit/dsl/path_sanity_spec.rb b/chef-utils/spec/unit/dsl/path_sanity_spec.rb
index 50cadd7466..6f536eb6d3 100644
--- a/chef-utils/spec/unit/dsl/path_sanity_spec.rb
+++ b/chef-utils/spec/unit/dsl/path_sanity_spec.rb
@@ -79,7 +79,7 @@ RSpec.describe ChefUtils::DSL::DefaultPaths do
end
it "prepends to an existing path" do
- env = { "PATH" => '%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\\' }
+ env = { "PATH" => "%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\" }
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]};%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\")
end
end
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/_openssl.rb b/kitchen-tests/cookbooks/end_to_end/recipes/_openssl.rb
index dba01e368f..62e11d6854 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/_openssl.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/_openssl.rb
@@ -1,6 +1,6 @@
# leaving this for the future where we test windows too
base = if platform_family?("windows")
- 'C:\ssl_test'
+ "C:\\ssl_test"
else
"/etc/ssl_test"
end
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/_windows_defender.rb b/kitchen-tests/cookbooks/end_to_end/recipes/_windows_defender.rb
index 90a0403ae3..2f6885a3df 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/_windows_defender.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/_windows_defender.rb
@@ -20,6 +20,6 @@ end
windows_defender_exclusion "Exclude PNG files" do
extensions "png"
- process_paths 'c:\\windows\\system32'
+ process_paths "c:\\windows\\system32"
action :add
end
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb b/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
index e6ec98ffde..c6ea3a9928 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
@@ -152,7 +152,7 @@ user "phil" do
action :remove
end
-directory 'C:\mordor' do
+directory "C:\\mordor" do
rights :full_control, "everyone"
end
diff --git a/kitchen-tests/test/integration/end-to-end/habitat_win_config/default_spec.rb b/kitchen-tests/test/integration/end-to-end/habitat_win_config/default_spec.rb
index c060050091..4439ebed8d 100644
--- a/kitchen-tests/test/integration/end-to-end/habitat_win_config/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/habitat_win_config/default_spec.rb
@@ -1,4 +1,4 @@
-describe file('C:\habitat\hab.exe') do
+describe file("C:\\habitat\\hab.exe") do
it { should exist }
end
@@ -7,7 +7,7 @@ end
# TODO: Inspec session seems to not have the updated windows system path when run with 'kitchen test'
# Works fine if you run a converge and then a verify as two separate commands
# For now, hitting hab.exe directly to avoid test failure
-describe command('C:\habitat\hab.exe -V') do
+describe command("C:\\habitat\\hab.exe -V") do
its("stdout") { should match(%r{^hab.*/}) }
its("exit_status") { should eq 0 }
end
diff --git a/kitchen-tests/test/integration/end-to-end/habitat_win_package/default_spec.rb b/kitchen-tests/test/integration/end-to-end/habitat_win_package/default_spec.rb
index da89ade930..734fb44c29 100644
--- a/kitchen-tests/test/integration/end-to-end/habitat_win_package/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/habitat_win_package/default_spec.rb
@@ -1,4 +1,4 @@
-describe file('C:\habitat\hab.exe') do
+describe file("C:\\habitat\\hab.exe") do
it { should exist }
end
@@ -7,17 +7,17 @@ end
# TODO: Inspec session seems to not have the updated windows system path when run with 'kitchen test'
# Works fine if you run a converge and then a verify as two separate commands
# For now, hitting hab.exe directly to avoid test failure
-describe command('C:\habitat\hab.exe -V') do
+describe command("C:\\habitat\\hab.exe -V") do
its("stdout") { should match(%r{^hab.*/}) }
its("exit_status") { should eq 0 }
end
-describe directory('C:\hab\pkgs\skylerto\splunkforwarder') do
+describe directory("C:\\hab\\pkgs\\skylerto\\splunkforwarder") do
it { should exist }
end
# TODO: Same issue as above
-describe command('C:\habitat\hab.exe pkg path skylerto/splunkforwarder') do
+describe command("C:\\habitat\\hab.exe pkg path skylerto/splunkforwarder") do
its("exit_status") { should eq 0 }
its("stdout") { should match(/C:\\hab\\pkgs\\skylerto\\splunkforwarder/) }
end
diff --git a/kitchen-tests/test/integration/end-to-end/habitat_win_service/default_spec.rb b/kitchen-tests/test/integration/end-to-end/habitat_win_service/default_spec.rb
index f66e5e79ac..453f8f546e 100644
--- a/kitchen-tests/test/integration/end-to-end/habitat_win_service/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/habitat_win_service/default_spec.rb
@@ -1,4 +1,4 @@
-describe directory('C:\hab\pkgs\skylerto\splunkforwarder') do
+describe directory("C:\\hab\\pkgs\\skylerto\\splunkforwarder") do
it { should exist }
end
@@ -6,7 +6,7 @@ describe directory('C:\hab\pkgs\ncr_devops_platform\sensu-agent-win') do
it { should exist }
end
-describe file('C:\hab\sup\default\specs\splunkforwarder.spec') do
+describe file("C:\\hab\\sup\\default\\specs\\splunkforwarder.spec") do
it { should_not exist }
end
@@ -25,7 +25,7 @@ describe json(command: servicecheck) do
its(%w{cfg backend-urls}) { should eq ["ws://127.0.0.1:8081"] }
its(["channel"]) { should eq "stable" }
its(["desired_state"]) { should eq "Down" }
- its(["spec_file"]) { should eq 'C:\\hab/sup\\default\\specs\\sensu-agent-win.spec' }
+ its(["spec_file"]) { should eq "C:\\hab/sup\\default\\specs\\sensu-agent-win.spec" }
its(["topology"]) { should eq "standalone" }
its(["update_strategy"]) { should eq "rolling" }
end
diff --git a/kitchen-tests/test/integration/end-to-end/habitat_win_sup/default_spec.rb b/kitchen-tests/test/integration/end-to-end/habitat_win_sup/default_spec.rb
index d1aa757cfc..d9b0ea7f89 100644
--- a/kitchen-tests/test/integration/end-to-end/habitat_win_sup/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/habitat_win_sup/default_spec.rb
@@ -1,4 +1,4 @@
-describe command('C:\habitat\hab.exe sup -h') do
+describe command("C:\\habitat\\hab.exe sup -h") do
its(:stdout) { should match(/The Habitat Supervisor/) }
end
diff --git a/kitchen-tests/test/integration/end-to-end/habitat_win_sup_toml_config/default_spec.rb b/kitchen-tests/test/integration/end-to-end/habitat_win_sup_toml_config/default_spec.rb
index 70a68ccf06..b239eadf63 100644
--- a/kitchen-tests/test/integration/end-to-end/habitat_win_sup_toml_config/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/habitat_win_sup_toml_config/default_spec.rb
@@ -1,4 +1,4 @@
-describe command('C:\habitat\hab.exe sup -h') do
+describe command("C:\\habitat\\hab.exe sup -h") do
its(:stdout) { should match(/The Habitat Supervisor/) }
end
diff --git a/kitchen-tests/test/integration/end-to-end/habitat_win_user_toml/default_spec.rb b/kitchen-tests/test/integration/end-to-end/habitat_win_user_toml/default_spec.rb
index 35f3fc20b7..856a9c805e 100644
--- a/kitchen-tests/test/integration/end-to-end/habitat_win_user_toml/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/habitat_win_user_toml/default_spec.rb
@@ -1,4 +1,4 @@
-describe file('C:\habitat\hab.exe') do
+describe file("C:\\habitat\\hab.exe") do
it { should exist }
end
diff --git a/lib/chef/chef_fs/file_pattern.rb b/lib/chef/chef_fs/file_pattern.rb
index 7e7a58e312..0aad1987e9 100644
--- a/lib/chef/chef_fs/file_pattern.rb
+++ b/lib/chef/chef_fs/file_pattern.rb
@@ -276,7 +276,7 @@ class Chef
regexp << ".*"
when "*"
exact = nil
- regexp << '[^\/]*'
+ regexp << "[^\\/]*"
when "?"
exact = nil
regexp << "."
diff --git a/lib/chef/chef_fs/path_utils.rb b/lib/chef/chef_fs/path_utils.rb
index 1682120c86..ec719bf2a3 100644
--- a/lib/chef/chef_fs/path_utils.rb
+++ b/lib/chef/chef_fs/path_utils.rb
@@ -58,7 +58,7 @@ class Chef
end
def self.regexp_path_separator
- ChefUtils.windows? ? '[\/\\\\]' : "/"
+ ChefUtils.windows? ? "[\\/\\\\]" : "/"
end
# Given a server path, determines if it is absolute.
diff --git a/lib/chef/dsl/reboot_pending.rb b/lib/chef/dsl/reboot_pending.rb
index e115d5441d..51481a98e3 100644
--- a/lib/chef/dsl/reboot_pending.rb
+++ b/lib/chef/dsl/reboot_pending.rb
@@ -37,7 +37,7 @@ class Chef
# due to a file being in use (usually a temporary file and a system file)
# \??\c:\temp\test.sys!\??\c:\winnt\system32\test.sys
# http://technet.microsoft.com/en-us/library/cc960241.aspx
- registry_value_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { name: "PendingFileRenameOperations" }) ||
+ registry_value_exists?("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager", { name: "PendingFileRenameOperations" }) ||
# RebootRequired key contains Update IDs with a value of 1 if they require a reboot.
# The existence of RebootRequired alone is sufficient on my Windows 8.1 workstation in Windows Update
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index 1c0b9f562e..e66a84365f 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -28,7 +28,7 @@ class Chef
extend Forwardable
provides :git
- GIT_VERSION_PATTERN = Regexp.compile('git version (\d+\.\d+.\d+)')
+ GIT_VERSION_PATTERN = Regexp.compile("git version (\\d+\\.\\d+.\\d+)")
def_delegator :new_resource, :destination, :cwd
diff --git a/lib/chef/provider/ifconfig/debian.rb b/lib/chef/provider/ifconfig/debian.rb
index 9b359d7c54..48e31472b8 100644
--- a/lib/chef/provider/ifconfig/debian.rb
+++ b/lib/chef/provider/ifconfig/debian.rb
@@ -87,7 +87,7 @@ iface <%= new_resource.device %> <%= new_resource.family %> static
directory INTERFACES_DOT_D_DIR
# roll our own file_edit resource, this will not get reported until we have a file_edit resource
- interfaces_dot_d_for_regexp = INTERFACES_DOT_D_DIR.gsub(/\./, '\.') # escape dots for the regexp
+ interfaces_dot_d_for_regexp = INTERFACES_DOT_D_DIR.gsub(/\./, "\\.") # escape dots for the regexp
regexp = %r{^\s*source\s+#{interfaces_dot_d_for_regexp}/\*\s*$}
return if ::File.exist?(INTERFACES_FILE) && regexp.match(IO.read(INTERFACES_FILE))
diff --git a/lib/chef/resource/habitat_install.rb b/lib/chef/resource/habitat_install.rb
index 86d979a35a..b87bb70bf4 100644
--- a/lib/chef/resource/habitat_install.rb
+++ b/lib/chef/resource/habitat_install.rb
@@ -95,10 +95,10 @@ class Chef
path habfile
destination "#{Chef::Config[:file_cache_path]}/habitat"
action :extract
- not_if { ::Dir.exist?('c:\habitat') }
+ not_if { ::Dir.exist?("c:\\habitat") }
end
- directory 'c:\habitat' do
+ directory "c:\\habitat" do
notifies :run, "powershell_script[installing from archive]", :immediately
end
@@ -110,7 +110,7 @@ class Chef
end
# TODO: This won't self heal if missing until the next upgrade
- windows_path 'C:\habitat' do
+ windows_path "C:\\habitat" do
action :add
end
else
diff --git a/lib/chef/resource/inspec_waiver.rb b/lib/chef/resource/inspec_waiver.rb
index bf50684547..f518d80d7a 100644
--- a/lib/chef/resource/inspec_waiver.rb
+++ b/lib/chef/resource/inspec_waiver.rb
@@ -116,7 +116,7 @@ class Chef
description: "The expiration date of the waiver - provided in YYYY-MM-DD format",
callbacks: {
"Expiration date should be a valid calendar date and match the following format: YYYY-MM-DD" => proc { |e|
- re = Regexp.new('\d{4}-\d{2}-\d{2}$').freeze
+ re = Regexp.new("\\d{4}-\\d{2}-\\d{2}$").freeze
if re.match?(e)
Date.valid_date?(*e.split("-").map(&:to_i))
else
diff --git a/lib/chef/resource/inspec_waiver_file_entry.rb b/lib/chef/resource/inspec_waiver_file_entry.rb
index 5f81be73da..8b8a0b9415 100644
--- a/lib/chef/resource/inspec_waiver_file_entry.rb
+++ b/lib/chef/resource/inspec_waiver_file_entry.rb
@@ -74,7 +74,7 @@ class Chef
description: "The expiration date of the given waiver - provided in YYYY-MM-DD format",
callbacks: {
"Expiration date should be a valid calendar date and match the following format: YYYY-MM-DD" => proc { |e|
- re = Regexp.new('\d{4}-\d{2}-\d{2}$').freeze
+ re = Regexp.new("\\d{4}-\\d{2}-\\d{2}$").freeze
if re.match?(e)
Date.valid_date?(*e.split("-").map(&:to_i))
else
diff --git a/lib/chef/resource/windows_auto_run.rb b/lib/chef/resource/windows_auto_run.rb
index 9e46b58b53..394960b88e 100644
--- a/lib/chef/resource/windows_auto_run.rb
+++ b/lib/chef/resource/windows_auto_run.rb
@@ -88,7 +88,7 @@ class Chef
# @return [String]
def registry_path
{ machine: "HKLM", user: "HKCU" }[new_resource.root] + \
- '\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run'
+ "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
end
end
end
diff --git a/lib/chef/resource/windows_dfs_namespace.rb b/lib/chef/resource/windows_dfs_namespace.rb
index 2fdfd8ebb6..3d1a08f3a3 100644
--- a/lib/chef/resource/windows_dfs_namespace.rb
+++ b/lib/chef/resource/windows_dfs_namespace.rb
@@ -38,7 +38,7 @@ class Chef
property :full_users, Array,
description: "Determines which users should have full access to the share.",
- default: ['BUILTIN\\administrators']
+ default: ["BUILTIN\\administrators"]
property :change_users, Array,
description: "Determines which users should have change access to the share.",
@@ -50,7 +50,7 @@ class Chef
property :root, String,
description: "The root from which to create the DFS tree. Defaults to C:\\DFSRoots.",
- default: 'C:\\DFSRoots'
+ default: "C:\\DFSRoots"
action :create, description: "Creates the dfs namespace on the server." do
directory file_path do
diff --git a/lib/chef/resource/windows_update_settings.rb b/lib/chef/resource/windows_update_settings.rb
index 3f8cf95acb..4d9d76463b 100644
--- a/lib/chef/resource/windows_update_settings.rb
+++ b/lib/chef/resource/windows_update_settings.rb
@@ -145,7 +145,7 @@ class Chef
action :set, description: "Set Windows Update settings." do
actual_day = convert_day(new_resource.scheduled_install_day)
- registry_key 'HKEY_LOCAL_MACHINE\\Software\\Policies\\Microsoft\\Windows\\WindowsUpdate' do
+ registry_key "HKEY_LOCAL_MACHINE\\Software\\Policies\\Microsoft\\Windows\\WindowsUpdate" do
recursive true
values [{
name: "DisableOSUpgrade",
@@ -180,7 +180,7 @@ class Chef
action :create
end
- registry_key 'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer' do
+ registry_key "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer" do
recursive true
values [{
name: "NoWindowsUpdate",
@@ -190,7 +190,7 @@ class Chef
action :create
end
- registry_key 'HKEY_LOCAL_MACHINE\\Software\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU' do
+ registry_key "HKEY_LOCAL_MACHINE\\Software\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU" do
recursive true
values [{
name: "AUOptions",
diff --git a/spec/functional/dsl/reboot_pending_spec.rb b/spec/functional/dsl/reboot_pending_spec.rb
index 9ff3f5495c..a3b3b62e13 100644
--- a/spec/functional/dsl/reboot_pending_spec.rb
+++ b/spec/functional/dsl/reboot_pending_spec.rb
@@ -39,8 +39,8 @@ describe Chef::DSL::RebootPending, :windows_only do
let(:reg_key) { nil }
let(:original_set) { false }
- describe 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations' do
- let(:reg_key) { 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager' }
+ describe "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\PendingFileRenameOperations" do
+ let(:reg_key) { "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager" }
let(:original_set) { registry.value_exists?(reg_key, { name: "PendingFileRenameOperations" }) }
it "returns true if the registry value exists" do
@@ -78,7 +78,7 @@ describe Chef::DSL::RebootPending, :windows_only do
describe "when there is nothing to indicate a reboot is pending" do
it "should return false" do
- skip "reboot pending" if registry_value_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { name: "PendingFileRenameOperations" }) ||
+ skip "reboot pending" if registry_value_exists?("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager", { name: "PendingFileRenameOperations" }) ||
registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired') ||
registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending')
expect(recipe.reboot_pending?).to be_falsey
diff --git a/spec/functional/dsl/registry_helper_spec.rb b/spec/functional/dsl/registry_helper_spec.rb
index 9d043dd35f..47111ac726 100644
--- a/spec/functional/dsl/registry_helper_spec.rb
+++ b/spec/functional/dsl/registry_helper_spec.rb
@@ -24,7 +24,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
before(:all) do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root"
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch"
- ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root', Win32::Registry::KEY_ALL_ACCESS) do |reg|
+ ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root", Win32::Registry::KEY_ALL_ACCESS) do |reg|
reg["RootType1", Win32::Registry::REG_SZ] = "fibrous"
reg.write("Roots", Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"])
end
diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb
index b22599266b..cd88200e1a 100644
--- a/spec/functional/resource/dsc_script_spec.rb
+++ b/spec/functional/resource/dsc_script_spec.rb
@@ -85,7 +85,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only, :ruby64_only d
let(:dsc_test_resource_base) do
Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context)
end
- let(:test_registry_key) { 'HKEY_LOCAL_MACHINE\Software\Chef\Spec\Functional\Resource\dsc_script_spec' }
+ let(:test_registry_key) { "HKEY_LOCAL_MACHINE\\Software\\Chef\\Spec\\Functional\\Resource\\dsc_script_spec" }
let(:test_registry_value) { "Registration" }
let(:test_registry_data1) { "LL927" }
let(:test_registry_data2) { "LL928" }
@@ -394,7 +394,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only, :ruby64_only d
dsc_test_run_context.node.consume_external_attrs(OHAI_SYSTEM.data, {})
end
- let(:configuration_data_path) { 'C:\\configurationdata.psd1' }
+ let(:configuration_data_path) { "C:\\configurationdata.psd1" }
let(:self_signed_cert_path) do
File.join(CHEF_SPEC_DATA, "dsc_lcm.pfx")
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb
index f3ad946f0e..77b73d941e 100644
--- a/spec/functional/resource/registry_spec.rb
+++ b/spec/functional/resource/registry_spec.rb
@@ -75,19 +75,19 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
def create_deletable_keys
# create them both 32-bit and 64-bit
[ 0x0100, 0x0200 ].each do |flag|
- hive_class.create(key_parent + '\Opscode', Win32::Registry::KEY_WRITE | flag)
- hive_class.open(key_parent + '\Opscode', Win32::Registry::KEY_ALL_ACCESS | flag) do |reg|
+ hive_class.create(key_parent + "\\Opscode", Win32::Registry::KEY_WRITE | flag)
+ hive_class.open(key_parent + "\\Opscode", Win32::Registry::KEY_ALL_ACCESS | flag) do |reg|
reg["Color", Win32::Registry::REG_SZ] = "Orange"
reg.write("Opscode", Win32::Registry::REG_MULTI_SZ, %w{Seattle Washington})
reg["AKA", Win32::Registry::REG_SZ] = "OC"
end
- hive_class.create(key_parent + '\ReportKey', Win32::Registry::KEY_WRITE | flag)
- hive_class.open(key_parent + '\ReportKey', Win32::Registry::KEY_ALL_ACCESS | flag) do |reg|
+ hive_class.create(key_parent + "\\ReportKey", Win32::Registry::KEY_WRITE | flag)
+ hive_class.open(key_parent + "\\ReportKey", Win32::Registry::KEY_ALL_ACCESS | flag) do |reg|
reg["ReportVal4", Win32::Registry::REG_SZ] = "report4"
reg["ReportVal5", Win32::Registry::REG_SZ] = "report5"
end
- hive_class.create(key_parent + '\OpscodeWhyRun', Win32::Registry::KEY_WRITE | flag)
- hive_class.open(key_parent + '\OpscodeWhyRun', Win32::Registry::KEY_ALL_ACCESS | flag) do |reg|
+ hive_class.create(key_parent + "\\OpscodeWhyRun", Win32::Registry::KEY_WRITE | flag)
+ hive_class.open(key_parent + "\\OpscodeWhyRun", Win32::Registry::KEY_ALL_ACCESS | flag) do |reg|
reg["BriskWalk", Win32::Registry::REG_SZ] = "is good for health"
end
end
@@ -188,13 +188,13 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
end
it "creates subkey if parent exists" do
- @new_resource.key(reg_child + '\OpscodeTest')
+ @new_resource.key(reg_child + "\\OpscodeTest")
@new_resource.values([{ name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} }])
@new_resource.recursive(false)
@new_resource.run_action(:create)
- expect(@registry.key_exists?(reg_child + '\OpscodeTest')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\OpscodeTest', { name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} })).to eq(true)
+ expect(@registry.key_exists?(reg_child + "\\OpscodeTest")).to eq(true)
+ expect(@registry.value_exists?(reg_child + "\\OpscodeTest", { name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} })).to eq(true)
end
it "raises an error if action create and parent does not exist and recursive is set to false" do
@@ -258,20 +258,20 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
@registry.architecture = :machine
end
it "creates a key in a 32-bit registry that is not viewable in 64-bit" do
- @new_resource.key(reg_child + '\Atraxi' )
+ @new_resource.key(reg_child + "\\Atraxi" )
@new_resource.values([{ name: "OC", type: :string, data: "Data" }])
@new_resource.recursive(true)
@new_resource.architecture(:i386)
@new_resource.run_action(:create)
@registry.architecture = :i386
- expect(@registry.data_exists?(reg_child + '\Atraxi', { name: "OC", type: :string, data: "Data" })).to eq(true)
+ expect(@registry.data_exists?(reg_child + "\\Atraxi", { name: "OC", type: :string, data: "Data" })).to eq(true)
@registry.architecture = :x86_64
- expect(@registry.key_exists?(reg_child + '\Atraxi')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Atraxi")).to eq(false)
end
end
it "prepares the reporting data for action :create" do
- @new_resource.key(reg_child + '\Ood')
+ @new_resource.key(reg_child + "\\Ood")
@new_resource.values([{ name: "ReportingVal1", type: :string, data: "report1" }, { name: "ReportingVal2", type: :string, data: "report2" }])
@new_resource.recursive(true)
@new_resource.run_action(:create)
@@ -280,7 +280,7 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
expect(@report["action"]).to eq("end")
expect(@report["resources"][0]["type"]).to eq("registry_key")
expect(@report["resources"][0]["name"]).to eq(resource_name)
- expect(@report["resources"][0]["id"]).to eq(reg_child + '\Ood')
+ expect(@report["resources"][0]["id"]).to eq(reg_child + "\\Ood")
expect(@report["resources"][0]["after"][:values]).to eq([{ name: "ReportingVal1", type: :string, data: "report1" },
{ name: "ReportingVal2", type: :string, data: "report2" }])
expect(@report["resources"][0]["before"][:values]).to eq([])
@@ -295,48 +295,48 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
end
it "does not raise an exception if the keys do not exist but recursive is set to false" do
- @new_resource.key(reg_child + '\Slitheen\Raxicoricofallapatorius')
+ @new_resource.key(reg_child + "\\Slitheen\\Raxicoricofallapatorius")
@new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create) # should not raise_error
- expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
- expect(@registry.key_exists?(reg_child + '\Slitheen\Raxicoricofallapatorius')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Slitheen\\Raxicoricofallapatorius")).to eq(false)
end
it "does not create key if the action is create" do
- @new_resource.key(reg_child + '\Slitheen')
+ @new_resource.key(reg_child + "\\Slitheen")
@new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create)
- expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false)
end
it "does not raise an exception if the action create and type key missing in values hash" do
- @new_resource.key(reg_child + '\Slitheen')
+ @new_resource.key(reg_child + "\\Slitheen")
@new_resource.values([{ name: "BriskWalk", data: "my_data" }])
@new_resource.run_action(:create) # should not raise_error
- expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false)
end
it "does not raise an exception if the action create and data key missing in values hash" do
- @new_resource.key(reg_child + '\Slitheen')
+ @new_resource.key(reg_child + "\\Slitheen")
@new_resource.values([{ name: "BriskWalk", type: :string }])
@new_resource.run_action(:create) # should not raise_error
- expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false)
end
it "does not raise an exception if the action create and only name key present in values hash" do
- @new_resource.key(reg_child + '\Slitheen')
+ @new_resource.key(reg_child + "\\Slitheen")
@new_resource.values([{ name: "BriskWalk" }])
@new_resource.run_action(:create) # should not raise_error
- expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false)
end
it "does not raise an exception if the action create and all keys are present in values hash" do
- @new_resource.key(reg_child + '\Slitheen')
+ @new_resource.key(reg_child + "\\Slitheen")
@new_resource.values([{ name: "BriskWalk", type: :string, data: "my_data" }])
@new_resource.run_action(:create) # should not raise_error
- expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Slitheen")).to eq(false)
end
end
end
@@ -374,17 +374,17 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
end
it "creates subkey if parent exists" do
- @new_resource.key(reg_child + '\Pyrovile')
+ @new_resource.key(reg_child + "\\Pyrovile")
@new_resource.values([{ name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} }])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing)
- expect(@registry.key_exists?(reg_child + '\Pyrovile')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\Pyrovile', { name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} })).to eq(true)
+ expect(@registry.key_exists?(reg_child + "\\Pyrovile")).to eq(true)
+ expect(@registry.value_exists?(reg_child + "\\Pyrovile", { name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} })).to eq(true)
end
it "raises an error if action create and parent does not exist and recursive is set to false" do
- @new_resource.key(reg_child + '\Sontaran\Sontar')
+ @new_resource.key(reg_child + "\\Sontaran\\Sontar")
@new_resource.values([{ name: "OC", type: :string, data: "MissingData" }])
@new_resource.recursive(false)
expect { @new_resource.run_action(:create_if_missing) }.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
@@ -415,28 +415,28 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
end
it "creates missing keys if action create and parent does not exist and recursive is set to true" do
- @new_resource.key(reg_child + '\Sontaran\Sontar')
+ @new_resource.key(reg_child + "\\Sontaran\\Sontar")
@new_resource.values([{ name: "OC", type: :string, data: "MissingData" }])
@new_resource.recursive(true)
@new_resource.run_action(:create_if_missing)
- expect(@registry.key_exists?(reg_child + '\Sontaran\Sontar')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\Sontaran\Sontar', { name: "OC", type: :string, data: "MissingData" })).to eq(true)
+ expect(@registry.key_exists?(reg_child + "\\Sontaran\\Sontar")).to eq(true)
+ expect(@registry.value_exists?(reg_child + "\\Sontaran\\Sontar", { name: "OC", type: :string, data: "MissingData" })).to eq(true)
end
it "creates key with multiple value as specified" do
- @new_resource.key(reg_child + '\Adipose')
+ @new_resource.key(reg_child + "\\Adipose")
@new_resource.values([{ name: "one", type: :string, data: "1" }, { name: "two", type: :string, data: "2" }, { name: "three", type: :string, data: "3" }])
@new_resource.recursive(true)
@new_resource.run_action(:create_if_missing)
@new_resource.each_value do |value|
- expect(@registry.value_exists?(reg_child + '\Adipose', value)).to eq(true)
+ expect(@registry.value_exists?(reg_child + "\\Adipose", value)).to eq(true)
end
end
it "prepares the reporting data for :create_if_missing" do
- @new_resource.key(reg_child + '\Judoon')
+ @new_resource.key(reg_child + "\\Judoon")
@new_resource.values([{ name: "ReportingVal3", type: :string, data: "report3" }])
@new_resource.recursive(true)
@new_resource.run_action(:create_if_missing)
@@ -445,7 +445,7 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
expect(@report["action"]).to eq("end")
expect(@report["resources"][0]["type"]).to eq("registry_key")
expect(@report["resources"][0]["name"]).to eq(resource_name)
- expect(@report["resources"][0]["id"]).to eq(reg_child + '\Judoon')
+ expect(@report["resources"][0]["id"]).to eq(reg_child + "\\Judoon")
expect(@report["resources"][0]["after"][:values]).to eq([{ name: "ReportingVal3", type: :string, data: "report3" }])
expect(@report["resources"][0]["before"][:values]).to eq([])
expect(@report["resources"][0]["result"]).to eq("create_if_missing")
@@ -459,48 +459,48 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
end
it "does not raise an exception if the keys do not exist but recursive is set to false" do
- @new_resource.key(reg_child + '\Zygons\Zygor')
+ @new_resource.key(reg_child + "\\Zygons\\Zygor")
@new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing) # should not raise_error
- expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
- expect(@registry.key_exists?(reg_child + '\Zygons\Zygor')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Zygons\\Zygor")).to eq(false)
end
it "does nothing if the action is create_if_missing" do
- @new_resource.key(reg_child + '\Zygons')
+ @new_resource.key(reg_child + "\\Zygons")
@new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing)
- expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false)
end
it "does not raise an exception if the action create_if_missing and type key missing in values hash" do
- @new_resource.key(reg_child + '\Zygons')
+ @new_resource.key(reg_child + "\\Zygons")
@new_resource.values([{ name: "BriskWalk", data: "my_data" }])
@new_resource.run_action(:create_if_missing) # should not raise_error
- expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false)
end
it "does not raise an exception if the action create_if_missing and data key missing in values hash" do
- @new_resource.key(reg_child + '\Zygons')
+ @new_resource.key(reg_child + "\\Zygons")
@new_resource.values([{ name: "BriskWalk", type: :string }])
@new_resource.run_action(:create_if_missing) # should not raise_error
- expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false)
end
it "does not raise an exception if the action create_if_missing and only name key present in values hash" do
- @new_resource.key(reg_child + '\Zygons')
+ @new_resource.key(reg_child + "\\Zygons")
@new_resource.values([{ name: "BriskWalk" }])
@new_resource.run_action(:create_if_missing) # should not raise_error
- expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false)
end
it "does not raise an exception if the action create_if_missing and all keys are present in values hash" do
- @new_resource.key(reg_child + '\Zygons')
+ @new_resource.key(reg_child + "\\Zygons")
@new_resource.values([{ name: "BriskWalk", type: :string, data: "my_data" }])
@new_resource.run_action(:create_if_missing) # should not raise_error
- expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
+ expect(@registry.key_exists?(reg_child + "\\Zygons")).to eq(false)
end
end
end
@@ -512,61 +512,61 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
end
it "takes no action if the specified key path does not exist in the system" do
- expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false)
+ expect(@registry.key_exists?(reg_parent + "\\Osirian")).to eq(false)
- @new_resource.key(reg_parent + '\Osirian')
+ @new_resource.key(reg_parent + "\\Osirian")
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false)
+ expect(@registry.key_exists?(reg_parent + "\\Osirian")).to eq(false)
end
it "takes no action if the key exists but the value does not" do
- expect(@registry.data_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(true)
+ expect(@registry.data_exists?(reg_parent + "\\Opscode", { name: "Color", type: :string, data: "Orange" })).to eq(true)
- @new_resource.key(reg_parent + '\Opscode')
+ @new_resource.key(reg_parent + "\\Opscode")
@new_resource.values([{ name: "LooksLike", type: :multi_string, data: %w{SeattleGrey OCOrange} }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- expect(@registry.data_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(true)
+ expect(@registry.data_exists?(reg_parent + "\\Opscode", { name: "Color", type: :string, data: "Orange" })).to eq(true)
end
it "deletes only specified values under a key path" do
- @new_resource.key(reg_parent + '\Opscode')
+ @new_resource.key(reg_parent + "\\Opscode")
@new_resource.values([{ name: "Opscode", type: :multi_string, data: %w{Seattle Washington} }, { name: "AKA", type: :string, data: "OC" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- expect(@registry.data_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(true)
- expect(@registry.value_exists?(reg_parent + '\Opscode', { name: "AKA", type: :string, data: "OC" })).to eq(false)
- expect(@registry.value_exists?(reg_parent + '\Opscode', { name: "Opscode", type: :multi_string, data: %w{Seattle Washington} })).to eq(false)
+ expect(@registry.data_exists?(reg_parent + "\\Opscode", { name: "Color", type: :string, data: "Orange" })).to eq(true)
+ expect(@registry.value_exists?(reg_parent + "\\Opscode", { name: "AKA", type: :string, data: "OC" })).to eq(false)
+ expect(@registry.value_exists?(reg_parent + "\\Opscode", { name: "Opscode", type: :multi_string, data: %w{Seattle Washington} })).to eq(false)
end
it "it deletes the values with the same name irrespective of it type and data" do
- @new_resource.key(reg_parent + '\Opscode')
+ @new_resource.key(reg_parent + "\\Opscode")
@new_resource.values([{ name: "Color", type: :multi_string, data: %w{Black Orange} }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- expect(@registry.value_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(false)
+ expect(@registry.value_exists?(reg_parent + "\\Opscode", { name: "Color", type: :string, data: "Orange" })).to eq(false)
end
it "prepares the reporting data for action :delete" do
- @new_resource.key(reg_parent + '\ReportKey')
+ @new_resource.key(reg_parent + "\\ReportKey")
@new_resource.values([{ name: "ReportVal4", type: :string, data: "report4" }, { name: "ReportVal5", type: :string, data: "report5" }])
@new_resource.recursive(true)
@new_resource.run_action(:delete)
@report = @resource_reporter.prepare_run_data
- expect(@registry.value_exists?(reg_parent + '\ReportKey', [{ name: "ReportVal4", type: :string, data: "report4" }, { name: "ReportVal5", type: :string, data: "report5" }])).to eq(false)
+ expect(@registry.value_exists?(reg_parent + "\\ReportKey", [{ name: "ReportVal4", type: :string, data: "report4" }, { name: "ReportVal5", type: :string, data: "report5" }])).to eq(false)
expect(@report["action"]).to eq("end")
expect(@report["resources"].count).to eq(1)
expect(@report["resources"][0]["type"]).to eq("registry_key")
expect(@report["resources"][0]["name"]).to eq(resource_name)
- expect(@report["resources"][0]["id"]).to eq(reg_parent + '\ReportKey')
+ expect(@report["resources"][0]["id"]).to eq(reg_parent + "\\ReportKey")
expect(@report["resources"][0]["before"][:values]).to eq([{ name: "ReportVal4", type: :string, data: "report4" },
{ name: "ReportVal5", type: :string, data: "report5" }])
# Not testing for after values to match since after -> new_resource values.
@@ -580,12 +580,12 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
Chef::Config[:why_run] = true
end
it "does nothing if the action is delete" do
- @new_resource.key(reg_parent + '\OpscodeWhyRun')
+ @new_resource.key(reg_parent + "\\OpscodeWhyRun")
@new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- expect(@registry.key_exists?(reg_parent + '\OpscodeWhyRun')).to eq(true)
+ expect(@registry.key_exists?(reg_parent + "\\OpscodeWhyRun")).to eq(true)
end
end
end
@@ -597,21 +597,21 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
end
it "takes no action if the specified key path does not exist in the system" do
- expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false)
+ expect(@registry.key_exists?(reg_parent + "\\Osirian")).to eq(false)
- @new_resource.key(reg_parent + '\Osirian')
+ @new_resource.key(reg_parent + "\\Osirian")
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
- expect(@registry.key_exists?(reg_parent + '\Osirian')).to eq(false)
+ expect(@registry.key_exists?(reg_parent + "\\Osirian")).to eq(false)
end
it "deletes key if it has no subkeys and recursive == false" do
- @new_resource.key(reg_parent + '\OpscodeTest')
+ @new_resource.key(reg_parent + "\\OpscodeTest")
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
- expect(@registry.key_exists?(reg_parent + '\OpscodeTest')).to eq(false)
+ expect(@registry.key_exists?(reg_parent + "\\OpscodeTest")).to eq(false)
end
it "raises an exception if the key has subkeys and recursive == false" do
@@ -621,22 +621,22 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
end
it "ignores the values under a key" do
- @new_resource.key(reg_parent + '\OpscodeIgnoredValues')
+ @new_resource.key(reg_parent + "\\OpscodeIgnoredValues")
# @new_resource.values([{:name=>"DontExist", :type=>:string, :data=>"These will be ignored anyways"}])
@new_resource.recursive(true)
@new_resource.run_action(:delete_key)
end
it "deletes the key if it has subkeys and recursive == true" do
- @new_resource.key(reg_parent + '\Opscode')
+ @new_resource.key(reg_parent + "\\Opscode")
@new_resource.recursive(true)
@new_resource.run_action(:delete_key)
- expect(@registry.key_exists?(reg_parent + '\Opscode')).to eq(false)
+ expect(@registry.key_exists?(reg_parent + "\\Opscode")).to eq(false)
end
it "prepares the reporting data for action :delete_key" do
- @new_resource.key(reg_parent + '\ReportKey')
+ @new_resource.key(reg_parent + "\\ReportKey")
@new_resource.recursive(true)
@new_resource.run_action(:delete_key)
@@ -644,7 +644,7 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
expect(@report["action"]).to eq("end")
expect(@report["resources"][0]["type"]).to eq("registry_key")
expect(@report["resources"][0]["name"]).to eq(resource_name)
- expect(@report["resources"][0]["id"]).to eq(reg_parent + '\ReportKey')
+ expect(@report["resources"][0]["id"]).to eq(reg_parent + "\\ReportKey")
# Not testing for before or after values to match since
# after -> new_resource.values and
# before -> current_resource.values
@@ -658,18 +658,18 @@ describe Chef::Resource::RegistryKey, :windows_only, broken: true do
end
it "does not throw an exception if the key has subkeys but recursive is set to false" do
- @new_resource.key(reg_parent + '\OpscodeWhyRun')
+ @new_resource.key(reg_parent + "\\OpscodeWhyRun")
@new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
end
it "does nothing if the action is delete_key" do
- @new_resource.key(reg_parent + '\OpscodeWhyRun')
+ @new_resource.key(reg_parent + "\\OpscodeWhyRun")
@new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
- expect(@registry.key_exists?(reg_parent + '\OpscodeWhyRun')).to eq(true)
+ expect(@registry.key_exists?(reg_parent + "\\OpscodeWhyRun")).to eq(true)
end
end
end
diff --git a/spec/functional/win32/registry_spec.rb b/spec/functional/win32/registry_spec.rb
index 2b371ee9ed..5f7f39e8d6 100644
--- a/spec/functional/win32/registry_spec.rb
+++ b/spec/functional/win32/registry_spec.rb
@@ -28,14 +28,14 @@ describe "Chef::Win32::Registry", :windows_only do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch"
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\BĀ®anch"
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch\\Flower"
- ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root', Win32::Registry::KEY_ALL_ACCESS) do |reg|
+ ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root", Win32::Registry::KEY_ALL_ACCESS) do |reg|
reg["RootType1", Win32::Registry::REG_SZ] = "fibrous"
reg.write("Roots", Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"])
end
- ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch', Win32::Registry::KEY_ALL_ACCESS) do |reg|
+ ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root\\Branch", Win32::Registry::KEY_ALL_ACCESS) do |reg|
reg["Strong", Win32::Registry::REG_SZ] = "bird nest"
end
- ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch\\Flower', Win32::Registry::KEY_ALL_ACCESS) do |reg|
+ ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root\\Branch\\Flower", Win32::Registry::KEY_ALL_ACCESS) do |reg|
reg["Petals", Win32::Registry::REG_MULTI_SZ] = %w{Pink Delicate}
end
@@ -297,7 +297,7 @@ describe "Chef::Win32::Registry", :windows_only do
describe "delete_value" do
before(:all) do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Trunk\\Peck\\Woodpecker"
- ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Trunk\\Peck\\Woodpecker', Win32::Registry::KEY_ALL_ACCESS) do |reg|
+ ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root\\Trunk\\Peck\\Woodpecker", Win32::Registry::KEY_ALL_ACCESS) do |reg|
reg["Peter", Win32::Registry::REG_SZ] = "Tiny"
end
end
@@ -324,11 +324,11 @@ describe "Chef::Win32::Registry", :windows_only do
describe "delete_key" do
before(:all) do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch\\Fruit"
- ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch\\Fruit', Win32::Registry::KEY_ALL_ACCESS) do |reg|
+ ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root\\Branch\\Fruit", Win32::Registry::KEY_ALL_ACCESS) do |reg|
reg["Apple", Win32::Registry::REG_MULTI_SZ] = %w{Red Juicy}
end
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Trunk\\Peck\\Woodpecker"
- ::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Trunk\\Peck\\Woodpecker', Win32::Registry::KEY_ALL_ACCESS) do |reg|
+ ::Win32::Registry::HKEY_CURRENT_USER.open("Software\\Root\\Trunk\\Peck\\Woodpecker", Win32::Registry::KEY_ALL_ACCESS) do |reg|
reg["Peter", Win32::Registry::REG_SZ] = "Tiny"
end
end
@@ -519,12 +519,12 @@ describe "Chef::Win32::Registry", :windows_only do
end
# 64-bit
::Win32::Registry::HKEY_LOCAL_MACHINE.create("Software\\Root\\Mauve", ::Win32::Registry::KEY_ALL_ACCESS | 0x0100)
- ::Win32::Registry::HKEY_LOCAL_MACHINE.open('Software\\Root\\Mauve', Win32::Registry::KEY_ALL_ACCESS | 0x0100) do |reg|
+ ::Win32::Registry::HKEY_LOCAL_MACHINE.open("Software\\Root\\Mauve", Win32::Registry::KEY_ALL_ACCESS | 0x0100) do |reg|
reg["Alert", Win32::Registry::REG_SZ] = "Universal"
end
# 32-bit
::Win32::Registry::HKEY_LOCAL_MACHINE.create("Software\\Root\\Poosh", ::Win32::Registry::KEY_ALL_ACCESS | 0x0200)
- ::Win32::Registry::HKEY_LOCAL_MACHINE.open('Software\\Root\\Poosh', Win32::Registry::KEY_ALL_ACCESS | 0x0200) do |reg|
+ ::Win32::Registry::HKEY_LOCAL_MACHINE.open("Software\\Root\\Poosh", Win32::Registry::KEY_ALL_ACCESS | 0x0200) do |reg|
reg["Status", Win32::Registry::REG_SZ] = "Lost"
end
end
diff --git a/spec/unit/dsl/reboot_pending_spec.rb b/spec/unit/dsl/reboot_pending_spec.rb
index 90945c3b80..3156d31e7e 100644
--- a/spec/unit/dsl/reboot_pending_spec.rb
+++ b/spec/unit/dsl/reboot_pending_spec.rb
@@ -36,7 +36,7 @@ describe Chef::DSL::RebootPending do
end
it 'should return true if "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations" exists' do
- allow(recipe).to receive(:registry_value_exists?).with('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { name: "PendingFileRenameOperations" }).and_return(true)
+ allow(recipe).to receive(:registry_value_exists?).with("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager", { name: "PendingFileRenameOperations" }).and_return(true)
expect(recipe.reboot_pending?).to be_truthy
end
diff --git a/spec/unit/mixin/default_paths_spec.rb b/spec/unit/mixin/default_paths_spec.rb
index 0224b8f4ce..6d16cc6f6c 100644
--- a/spec/unit/mixin/default_paths_spec.rb
+++ b/spec/unit/mixin/default_paths_spec.rb
@@ -84,7 +84,7 @@ describe Chef::Mixin::DefaultPaths do
allow(Gem).to receive(:bindir).and_return(gem_bindir)
allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return(ruby_bindir)
allow(ChefUtils).to receive(:windows?).and_return(true)
- env = { "PATH" => 'C:\Windows\system32;C:\mr\softie' }
+ env = { "PATH" => "C:\\Windows\\system32;C:\\mr\\softie" }
@default_paths.enforce_default_paths(env)
expect(env["PATH"]).to eq("#{gem_bindir};#{ruby_bindir};C:\\Windows\\system32;C:\\mr\\softie")
end
diff --git a/spec/unit/mixin/securable_spec.rb b/spec/unit/mixin/securable_spec.rb
index bbbd6bab84..b672dc19f5 100644
--- a/spec/unit/mixin/securable_spec.rb
+++ b/spec/unit/mixin/securable_spec.rb
@@ -53,8 +53,8 @@ describe Chef::Mixin::Securable do
end
it "should accept group/owner names with spaces and backslashes" do
- expect { @securable.group 'test\ group' }.not_to raise_error
- expect { @securable.owner 'test\ group' }.not_to raise_error
+ expect { @securable.group "test\\ group" }.not_to raise_error
+ expect { @securable.owner "test\\ group" }.not_to raise_error
end
it "should accept group/owner names that are a single character or digit" do
@@ -186,7 +186,7 @@ describe Chef::Mixin::Securable do
end
it "should not accept a group name or id for group with spaces and multiple backslashes" do
- expect { @securable.group 'test\ \group' }.to raise_error(ArgumentError)
+ expect { @securable.group "test\\ \\group" }.to raise_error(ArgumentError)
end
it "should accept a unix file mode in string form as an octal number" do
diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb
index 5013b6505c..6ef63d3961 100644
--- a/spec/unit/provider/package/rubygems_spec.rb
+++ b/spec/unit/provider/package/rubygems_spec.rb
@@ -503,11 +503,11 @@ describe Chef::Provider::Package::Rubygems do
platform_mock :windows do
allow(ENV).to receive(:[]).with("PATH").and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin')
allow(ENV).to receive(:[]).with("PATHEXT").and_return(nil)
- allow(File).to receive(:executable?).with('C:\\windows\\system32/gem').and_return(false)
- allow(File).to receive(:executable?).with('C:\\windows/gem').and_return(false)
- allow(File).to receive(:executable?).with('C:\\Ruby186\\bin/gem').and_return(true)
- allow(File).to receive(:executable?).with('d:\\opscode\\chef\\bin/gem').and_return(false) # should not get here
- allow(File).to receive(:executable?).with('d:\\opscode\\chef\\bin/gem').and_return(false) # should not get here
+ allow(File).to receive(:executable?).with("C:\\windows\\system32/gem").and_return(false)
+ allow(File).to receive(:executable?).with("C:\\windows/gem").and_return(false)
+ allow(File).to receive(:executable?).with("C:\\Ruby186\\bin/gem").and_return(true)
+ allow(File).to receive(:executable?).with("d:\\opscode\\chef\\bin/gem").and_return(false) # should not get here
+ allow(File).to receive(:executable?).with("d:\\opscode\\chef\\bin/gem").and_return(false) # should not get here
allow(File).to receive(:executable?).with("d:/opscode/chef/embedded/bin/gem").and_return(false) # should not get here
expect(provider.gem_env.gem_binary_location).to eq('C:\Ruby186\bin/gem')
end
diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb
index 6531d9c5ec..29ca8ce521 100644
--- a/spec/unit/provider/package/windows_spec.rb
+++ b/spec/unit/provider/package/windows_spec.rb
@@ -39,7 +39,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
new_resource
end
let(:provider) { Chef::Provider::Package::Windows.new(new_resource, run_context) }
- let(:cache_path) { 'c:\\cache\\' }
+ let(:cache_path) { "c:\\cache\\" }
before(:each) do
allow(::File).to receive(:exist?).with(new_resource.source).and_return(true)
diff --git a/spec/unit/provider/registry_key_spec.rb b/spec/unit/provider/registry_key_spec.rb
index fe643a0ec3..76f039a9b9 100644
--- a/spec/unit/provider/registry_key_spec.rb
+++ b/spec/unit/provider/registry_key_spec.rb
@@ -274,7 +274,7 @@ describe Chef::Provider::RegistryKey do
end
context "when the key data is safe" do
- let(:keyname) { 'HKLM\Software\Opscode\Testing\Safe' }
+ let(:keyname) { "HKLM\\Software\\Opscode\\Testing\\Safe" }
let(:testval1) { { name: "one", type: :string, data: "1" } }
let(:testval1_wrong_type) { { name: "one", type: :multi_string, data: "1" } }
let(:testval1_wrong_data) { { name: "one", type: :string, data: "2" } }
@@ -295,7 +295,7 @@ describe Chef::Provider::RegistryKey do
describe "action_create" do
context "when key exists and type matches" do
- let(:keyname) { 'hklm\\software\\opscode\\testing\\dword' }
+ let(:keyname) { "hklm\\software\\opscode\\testing\\dword" }
let(:dword_passed_as_integer) { { name: "one", type: :dword, data: 12345 } }
let(:testval1) { { name: "one", type: :dword, data: "12345" } }
before do
@@ -349,7 +349,7 @@ describe Chef::Provider::RegistryKey do
end
context "and key does not exist" do
- let(:keyname) { 'hklm\\software\\opscode\\testing\\sensitive\missing' }
+ let(:keyname) { "hklm\\software\\opscode\\testing\\sensitive\\missing" }
let(:testval1) { { name: "one", type: :string, data: "first_value" } }
before(:each) do
@@ -368,7 +368,7 @@ describe Chef::Provider::RegistryKey do
describe "action_create_if_missing" do
context "when sensitive is true" do
- let(:keyname) { 'hklm\\software\\opscode\\testing\\create_if_missing\\sensitive' }
+ let(:keyname) { "hklm\\software\\opscode\\testing\\create_if_missing\\sensitive" }
let(:testval1) { { name: "one", type: :string, data: "first_value" } }
before(:each) do
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 08d4b2a620..2186298143 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -33,7 +33,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do
# Actual response from Win32::Service.config_info('chef-client')
let(:chef_service_binary_path_name) do
- 'C:\\opscode\\chef\\embedded\\bin\\ruby.exe C:\\opscode\\chef\\bin\\chef-windows-service'
+ "C:\\opscode\\chef\\embedded\\bin\\ruby.exe C:\\opscode\\chef\\bin\\chef-windows-service"
end
let(:chef_service_config_info) do
double("Struct::ServiceConfigInfo",
@@ -153,11 +153,11 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do
service_type: "share process",
start_type: "demand start",
error_control: "normal",
- binary_path_name: 'C:\\Windows\\system32\\svchost.exe -k LocalServiceNetworkRestricted',
+ binary_path_name: "C:\\Windows\\system32\\svchost.exe -k LocalServiceNetworkRestricted",
load_order_group: "TDI",
tag_id: 0,
dependencies: %w{NSI Tdx Afd},
- service_start_name: 'NT Authority\\LocalService',
+ service_start_name: "NT Authority\\LocalService",
display_name: "DHCP Client")
)
end
@@ -169,11 +169,11 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do
service_type: "share process",
start_type: "demand start",
error_control: "normal",
- binary_path_name: 'C:\\Windows\\system32\\svchost.exe -k LocalServiceNetworkRestricted',
+ binary_path_name: "C:\\Windows\\system32\\svchost.exe -k LocalServiceNetworkRestricted",
load_order_group: "TDI",
tag_id: 0,
dependencies: %w{NSI Tdx Afd},
- service_start_name: 'NT Authority\\LocalService',
+ service_start_name: "NT Authority\\LocalService",
display_name: "DHCP Client")
)
end
diff --git a/spec/unit/provider/windows_env_spec.rb b/spec/unit/provider/windows_env_spec.rb
index 7f64622d20..eb3f65713f 100644
--- a/spec/unit/provider/windows_env_spec.rb
+++ b/spec/unit/provider/windows_env_spec.rb
@@ -358,7 +358,7 @@ describe "windows_env provider", :windows_only do
context "when environment is PATH" do
describe "for PATH" do
let(:system_root) { "%SystemRoot%" }
- let(:system_root_value) { 'D:\Windows' }
+ let(:system_root_value) { "D:\\Windows" }
let(:new_resource) do
new_resource = Chef::Resource::WindowsEnv.new("PATH", run_context)
new_resource.value(system_root)
diff --git a/spec/unit/provider/zypper_repository_spec.rb b/spec/unit/provider/zypper_repository_spec.rb
index 2cf4ed99c8..6b09c7bc9f 100644
--- a/spec/unit/provider/zypper_repository_spec.rb
+++ b/spec/unit/provider/zypper_repository_spec.rb
@@ -103,7 +103,7 @@ describe Chef::Provider::ZypperRepository do
describe "#escaped_repo_name" do
it "returns an escaped repo name" do
- expect(provider.escaped_repo_name).to eq('Nginx\\ Repository')
+ expect(provider.escaped_repo_name).to eq("Nginx\\ Repository")
end
end
diff --git a/spec/unit/resource/chocolatey_config_spec.rb b/spec/unit/resource/chocolatey_config_spec.rb
index 8c4ebfaecf..0a37654b4e 100644
--- a/spec/unit/resource/chocolatey_config_spec.rb
+++ b/spec/unit/resource/chocolatey_config_spec.rb
@@ -41,7 +41,7 @@ describe Chef::Resource::ChocolateyConfig do
# we save off the ENV and set ALLUSERSPROFILE so these specs will work on *nix and non-C drive Windows installs
before(:each) do
@original_env = ENV.to_hash
- ENV["ALLUSERSPROFILE"] = 'C:\ProgramData'
+ ENV["ALLUSERSPROFILE"] = "C:\\ProgramData"
end
after(:each) do
diff --git a/spec/unit/resource/chocolatey_feature_spec.rb b/spec/unit/resource/chocolatey_feature_spec.rb
index 0a3ec8e314..0ad2bc4039 100644
--- a/spec/unit/resource/chocolatey_feature_spec.rb
+++ b/spec/unit/resource/chocolatey_feature_spec.rb
@@ -41,7 +41,7 @@ describe Chef::Resource::ChocolateyFeature do
# we save off the ENV and set ALLUSERSPROFILE so these specs will work on *nix and non-C drive Windows installs
before(:each) do
@original_env = ENV.to_hash
- ENV["ALLUSERSPROFILE"] = 'C:\ProgramData'
+ ENV["ALLUSERSPROFILE"] = "C:\\ProgramData"
end
after(:each) do
diff --git a/spec/unit/resource/chocolatey_source_spec.rb b/spec/unit/resource/chocolatey_source_spec.rb
index d0066d3ccb..1e9a1001a5 100644
--- a/spec/unit/resource/chocolatey_source_spec.rb
+++ b/spec/unit/resource/chocolatey_source_spec.rb
@@ -54,7 +54,7 @@ describe Chef::Resource::ChocolateySource do
allow(resource).to receive(:provider_for_action).and_return(enable_provider)
allow(resource.class).to receive(:new).and_return(current_resource)
@original_env = ENV.to_hash
- ENV["ALLUSERSPROFILE"] = 'C:\ProgramData'
+ ENV["ALLUSERSPROFILE"] = "C:\\ProgramData"
end
after(:each) do
diff --git a/spec/unit/resource/registry_key_spec.rb b/spec/unit/resource/registry_key_spec.rb
index 86bd41ef92..e52c7843c7 100644
--- a/spec/unit/resource/registry_key_spec.rb
+++ b/spec/unit/resource/registry_key_spec.rb
@@ -19,14 +19,14 @@
require "spec_helper"
describe Chef::Resource::RegistryKey, "initialize" do
- let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
+ let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") }
it "sets the resource_name to :registry_key" do
expect(resource.resource_name).to eql(:registry_key)
end
it "the key property is the name_property" do
- expect(resource.key).to eql('HKCU\Software\Raxicoricofallapatorius')
+ expect(resource.key).to eql("HKCU\\Software\\Raxicoricofallapatorius")
end
it "sets the default action as :create" do
@@ -60,11 +60,11 @@ describe Chef::Resource::RegistryKey, "initialize" do
end
describe Chef::Resource::RegistryKey, "key" do
- let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
+ let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") }
it "allows a string" do
- resource.key 'HKCU\Software\Poosh'
- expect(resource.key).to eql('HKCU\Software\Poosh')
+ resource.key "HKCU\\Software\\Poosh"
+ expect(resource.key).to eql("HKCU\\Software\\Poosh")
end
it "does not allow an integer" do
@@ -77,7 +77,7 @@ describe Chef::Resource::RegistryKey, "key" do
end
describe Chef::Resource::RegistryKey, "values" do
- let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
+ let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") }
it "allows a single proper hash of registry values" do
resource.values( { name: "poosh", type: :string, data: "carmen" } )
@@ -140,7 +140,7 @@ describe Chef::Resource::RegistryKey, "values" do
end
describe Chef::Resource::RegistryKey, "recursive" do
- let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
+ let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") }
it "allows a boolean" do
resource.recursive(true)
@@ -165,7 +165,7 @@ describe Chef::Resource::RegistryKey, "recursive" do
end
describe Chef::Resource::RegistryKey, "architecture" do
- let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
+ let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") }
%i{i386 x86_64 machine}.each do |arch|
it "allows #{arch} as a symbol" do
@@ -196,7 +196,7 @@ describe Chef::Resource::RegistryKey, "architecture" do
end
describe Chef::Resource::RegistryKey, ":unscrubbed_values" do
- let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
+ let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") }
it "returns unsafe data as-is" do
key_values = [ { name: "poosh", type: :binary, data: 255.chr * 1 } ]
@@ -206,7 +206,7 @@ describe Chef::Resource::RegistryKey, ":unscrubbed_values" do
end
describe Chef::Resource::RegistryKey, "state" do
- let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
+ let(:resource) { Chef::Resource::RegistryKey.new("HKCU\\Software\\Raxicoricofallapatorius") }
it "returns scrubbed values" do
resource.values([ { name: "poosh", type: :binary, data: 255.chr * 1 } ])
diff --git a/spec/unit/resource/windows_auto_run_spec.rb b/spec/unit/resource/windows_auto_run_spec.rb
index 2e9f4a4f33..8d9a8aac96 100644
--- a/spec/unit/resource/windows_auto_run_spec.rb
+++ b/spec/unit/resource/windows_auto_run_spec.rb
@@ -45,6 +45,6 @@ describe Chef::Resource::WindowsAutorun do
it "coerces forward slashes to backslashes for the path" do
resource.path "C:/something.exe"
- expect(resource.path).to eql('C:\\something.exe')
+ expect(resource.path).to eql("C:\\something.exe")
end
end
diff --git a/spec/unit/resource/windows_feature_powershell_spec.rb b/spec/unit/resource/windows_feature_powershell_spec.rb
index 5b4062f34c..09e9018cf9 100644
--- a/spec/unit/resource/windows_feature_powershell_spec.rb
+++ b/spec/unit/resource/windows_feature_powershell_spec.rb
@@ -76,7 +76,7 @@ describe Chef::Resource::WindowsFeaturePowershell do
node.default["powershell_features_cache"]["disabled"] = ["dhcp"]
node.default["powershell_features_cache"]["removed"] = ["snmp"]
resource.feature_name "dhcp, snmp"
- resource.source 'D:\\sources\\sxs'
+ resource.source "D:\\sources\\sxs"
expect(provider.features_to_install).to eq(%w{dhcp snmp})
end
diff --git a/spec/unit/resource/windows_firewall_rule_spec.rb b/spec/unit/resource/windows_firewall_rule_spec.rb
index d73e7d222a..d3feea7c0a 100644
--- a/spec/unit/resource/windows_firewall_rule_spec.rb
+++ b/spec/unit/resource/windows_firewall_rule_spec.rb
@@ -377,7 +377,7 @@ describe Chef::Resource::WindowsFirewallRule do
resource.icmp_type("Any")
resource.firewall_action(:notconfigured)
resource.profile(:domain)
- resource.program('%WINDIR%\System32\lsass.exe')
+ resource.program("%WINDIR%\\System32\\lsass.exe")
resource.service("SomeService")
resource.interface_type(:remoteaccess)
resource.enabled(false)
@@ -499,7 +499,7 @@ describe Chef::Resource::WindowsFirewallRule do
resource.icmp_type("Any")
resource.firewall_action(:notconfigured)
resource.profile(:domain)
- resource.program('%WINDIR%\System32\lsass.exe')
+ resource.program("%WINDIR%\\System32\\lsass.exe")
resource.service("SomeService")
resource.interface_type(:remoteaccess)
resource.enabled(false)
diff --git a/spec/unit/resource/windows_task_spec.rb b/spec/unit/resource/windows_task_spec.rb
index b991cb89de..8b29e773b6 100644
--- a/spec/unit/resource/windows_task_spec.rb
+++ b/spec/unit/resource/windows_task_spec.rb
@@ -75,7 +75,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
context "a System User" do
before do
resource.frequency :hourly
- resource.user 'NT AUTHORITY\SYSTEM'
+ resource.user "NT AUTHORITY\\SYSTEM"
end
context "for an interactive task" do
@@ -88,7 +88,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
expect { resource.after_created }.to raise_error(ArgumentError, "Password is not required for system users.")
end
it "does not raises an error even when user is in lowercase" do
- resource.user 'nt authority\system'
+ resource.user "nt authority\\system"
expect { resource.after_created }.to_not raise_error
end
end
@@ -103,7 +103,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
expect { resource.after_created }.to raise_error(ArgumentError, "Password is not required for system users.")
end
it "does not raises an error even when user is in lowercase" do
- resource.user 'nt authority\system'
+ resource.user "nt authority\\system"
expect { resource.after_created }.to_not raise_error
end
end
diff --git a/spec/unit/resource_reporter_spec.rb b/spec/unit/resource_reporter_spec.rb
index 69d5b28e7e..cea866cb17 100644
--- a/spec/unit/resource_reporter_spec.rb
+++ b/spec/unit/resource_reporter_spec.rb
@@ -494,7 +494,7 @@ describe Chef::ResourceReporter do
context "when the resource is a RegistryKey with binary data" do
let(:new_resource) do
- resource = Chef::Resource::RegistryKey.new('Wubba\Lubba\Dub\Dubs')
+ resource = Chef::Resource::RegistryKey.new("Wubba\\Lubba\\Dub\\Dubs")
resource.values([ { name: "rick", type: :binary, data: 255.chr * 1 } ])
allow(resource).to receive(:cookbook_name).and_return(cookbook_name)
allow(resource).to receive(:cookbook_version).and_return(cookbook_version)
@@ -502,7 +502,7 @@ describe Chef::ResourceReporter do
end
let(:current_resource) do
- resource = Chef::Resource::RegistryKey.new('Wubba\Lubba\Dub\Dubs')
+ resource = Chef::Resource::RegistryKey.new("Wubba\\Lubba\\Dub\\Dubs")
resource.values([ { name: "rick", type: :binary, data: 255.chr * 1 } ])
resource
end
diff --git a/spec/unit/util/backup_spec.rb b/spec/unit/util/backup_spec.rb
index 1db64d3029..d7a57dce1a 100644
--- a/spec/unit/util/backup_spec.rb
+++ b/spec/unit/util/backup_spec.rb
@@ -132,7 +132,7 @@ describe Chef::Util::Backup do
end
it "uses the configured Chef::Config[:file_backup_path] and strips the drive on windows" do
- expect(@backup).to receive(:path).and_return('c:\\a\\b\\c.txt')
+ expect(@backup).to receive(:path).and_return("c:\\a\\b\\c.txt")
Chef::Config[:file_backup_path] = 'c:\backupdir'
expect(@backup.send(:backup_path)).to match(%r|^c:\\backupdir[\\/]+a\\b\\c.txt.chef-\d{14}.\d{6}$|)
end
diff --git a/spec/unit/win32/registry_spec.rb b/spec/unit/win32/registry_spec.rb
index 124765129b..992c5d99e2 100644
--- a/spec/unit/win32/registry_spec.rb
+++ b/spec/unit/win32/registry_spec.rb
@@ -23,12 +23,12 @@ describe Chef::Win32::Registry do
let(:value1) { { name: "one", type: :string, data: "1" } }
let(:value1_upcase_name) { { name: "ONE", type: :string, data: "1" } }
- let(:key_path) { 'HKCU\Software\OpscodeNumbers' }
- let(:key) { 'Software\OpscodeNumbers' }
+ let(:key_path) { "HKCU\\Software\\OpscodeNumbers" }
+ let(:key) { "Software\\OpscodeNumbers" }
let(:key_parent) { "Software" }
let(:key_to_delete) { "OpscodeNumbers" }
let(:sub_key) { "OpscodePrimes" }
- let(:missing_key_path) { 'HKCU\Software' }
+ let(:missing_key_path) { "HKCU\\Software" }
let(:registry) { Chef::Win32::Registry.new }
let(:hive_mock) { double("::Win32::Registry::HKEY_CURRENT_USER") }
let(:reg_mock) { double("reg") }