chef 16.2.50-universal-mingw32 → 16.2.73-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -15
  3. data/chef.gemspec +2 -2
  4. data/lib/chef/application/apply.rb +1 -0
  5. data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +2 -2
  6. data/lib/chef/digester.rb +3 -2
  7. data/lib/chef/file_access_control/windows.rb +2 -2
  8. data/lib/chef/file_content_management/deploy/mv_unix.rb +1 -1
  9. data/lib/chef/http.rb +1 -1
  10. data/lib/chef/knife/bootstrap.rb +12 -3
  11. data/lib/chef/knife/cookbook_upload.rb +1 -4
  12. data/lib/chef/knife/core/bootstrap_context.rb +1 -1
  13. data/lib/chef/knife/core/windows_bootstrap_context.rb +1 -1
  14. data/lib/chef/resource.rb +1 -1
  15. data/lib/chef/resource/dmg_package.rb +1 -1
  16. data/lib/chef/resource/launchd.rb +1 -1
  17. data/lib/chef/resource/windows_user_privilege.rb +25 -2
  18. data/lib/chef/version.rb +1 -1
  19. data/spec/functional/knife/configure_spec.rb +1 -1
  20. data/spec/functional/resource/aix_service_spec.rb +10 -1
  21. data/spec/functional/resource/aixinit_service_spec.rb +1 -1
  22. data/spec/functional/resource/bash_spec.rb +3 -2
  23. data/spec/functional/resource/bff_spec.rb +1 -1
  24. data/spec/functional/resource/chocolatey_package_spec.rb +4 -0
  25. data/spec/functional/resource/cron_spec.rb +10 -1
  26. data/spec/functional/resource/dnf_package_spec.rb +4 -1
  27. data/spec/functional/resource/execute_spec.rb +1 -1
  28. data/spec/functional/resource/group_spec.rb +9 -1
  29. data/spec/functional/resource/ifconfig_spec.rb +9 -1
  30. data/spec/functional/resource/insserv_spec.rb +3 -2
  31. data/spec/functional/resource/link_spec.rb +2 -5
  32. data/spec/functional/resource/mount_spec.rb +9 -1
  33. data/spec/functional/resource/msu_package_spec.rb +9 -3
  34. data/spec/functional/resource/powershell_script_spec.rb +4 -4
  35. data/spec/functional/resource/remote_file_spec.rb +6 -6
  36. data/spec/functional/resource/rpm_spec.rb +1 -1
  37. data/spec/functional/resource/timezone_spec.rb +2 -0
  38. data/spec/functional/resource/windows_package_spec.rb +0 -1
  39. data/spec/functional/resource/windows_path_spec.rb +4 -0
  40. data/spec/functional/resource/windows_security_policy_spec.rb +0 -1
  41. data/spec/functional/resource/windows_service_spec.rb +4 -0
  42. data/spec/functional/resource/windows_task_spec.rb +4 -3
  43. data/spec/functional/resource/windows_user_privilege_spec.rb +0 -1
  44. data/spec/functional/resource/yum_package_spec.rb +4 -1
  45. data/spec/functional/resource/zypper_package_spec.rb +4 -1
  46. data/spec/functional/shell_spec.rb +0 -1
  47. data/spec/functional/win32/crypto_spec.rb +1 -1
  48. data/spec/integration/knife/cookbook_upload_spec.rb +1 -1
  49. data/spec/integration/knife/data_bag_from_file_spec.rb +1 -1
  50. data/spec/integration/knife/environment_from_file_spec.rb +1 -1
  51. data/spec/integration/knife/node_from_file_spec.rb +1 -1
  52. data/spec/integration/knife/role_from_file_spec.rb +1 -1
  53. data/spec/integration/recipes/recipe_dsl_spec.rb +4 -0
  54. data/spec/integration/recipes/resource_load_spec.rb +2 -2
  55. data/spec/support/shared/functional/securable_resource.rb +1 -2
  56. data/spec/support/shared/functional/securable_resource_with_reporting.rb +0 -1
  57. data/spec/support/shared/functional/windows_script.rb +2 -2
  58. data/spec/support/shared/unit/provider/file.rb +12 -8
  59. data/spec/unit/application/solo_spec.rb +4 -2
  60. data/spec/unit/chef_fs/config_spec.rb +2 -2
  61. data/spec/unit/chef_fs/diff_spec.rb +8 -8
  62. data/spec/unit/client_spec.rb +4 -1
  63. data/spec/unit/cookbook/synchronizer_spec.rb +26 -24
  64. data/spec/unit/data_bag_spec.rb +6 -3
  65. data/spec/unit/decorator_spec.rb +23 -23
  66. data/spec/unit/environment_spec.rb +5 -1
  67. data/spec/unit/guard_interpreter_spec.rb +1 -1
  68. data/spec/unit/http/api_versions_spec.rb +1 -1
  69. data/spec/unit/knife/bootstrap_spec.rb +1 -0
  70. data/spec/unit/knife/cookbook_download_spec.rb +2 -2
  71. data/spec/unit/knife/cookbook_show_spec.rb +6 -7
  72. data/spec/unit/knife/data_bag_edit_spec.rb +1 -1
  73. data/spec/unit/lwrp_spec.rb +5 -2
  74. data/spec/unit/mixin/powershell_out_spec.rb +2 -4
  75. data/spec/unit/mixin/powershell_type_coercions_spec.rb +1 -1
  76. data/spec/unit/mixin/subclass_directive_spec.rb +2 -2
  77. data/spec/unit/mixin/unformatter_spec.rb +2 -2
  78. data/spec/unit/mixin/uris_spec.rb +1 -1
  79. data/spec/unit/provider/batch_spec.rb +1 -1
  80. data/spec/unit/provider/cron/unix_spec.rb +1 -1
  81. data/spec/unit/provider/dsc_resource_spec.rb +22 -38
  82. data/spec/unit/provider/dsc_script_spec.rb +10 -10
  83. data/spec/unit/provider/execute_spec.rb +1 -1
  84. data/spec/unit/provider/git_spec.rb +3 -3
  85. data/spec/unit/provider/mdadm_spec.rb +1 -3
  86. data/spec/unit/provider/package/openbsd_spec.rb +1 -1
  87. data/spec/unit/provider/package/pacman_spec.rb +17 -20
  88. data/spec/unit/provider/package/windows/registry_uninstall_entry_spec.rb +3 -3
  89. data/spec/unit/provider/user/dscl_spec.rb +2 -2
  90. data/spec/unit/provider/windows_env_spec.rb +5 -4
  91. data/spec/unit/resource/chef_client_cron_spec.rb +23 -7
  92. data/spec/unit/resource/chef_client_systemd_timer_spec.rb +7 -4
  93. data/spec/unit/resource/file/verification_spec.rb +2 -1
  94. data/spec/unit/resource_spec.rb +25 -8
  95. data/spec/unit/role_spec.rb +23 -21
  96. data/spec/unit/util/backup_spec.rb +1 -1
  97. data/spec/unit/util/powershell/ps_credential_spec.rb +2 -2
  98. data/spec/unit/util/selinux_spec.rb +2 -1
  99. metadata +20 -15
  100. data/spec/functional/resource/base.rb +0 -28
@@ -8,7 +8,7 @@ describe Chef::Provider::Package::Windows::RegistryUninstallEntry do
8
8
 
9
9
  describe "when QuietUninstallString key not present" do
10
10
  let(:quiet_uninstall_string) { nil }
11
- let (:quiet_uninstall_string_key) { Chef::Provider::Package::Windows::RegistryUninstallEntry.quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry).uninstall_string }
11
+ let(:quiet_uninstall_string_key) { Chef::Provider::Package::Windows::RegistryUninstallEntry.quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry).uninstall_string }
12
12
  it "returns UninstallString key value" do
13
13
  expect(quiet_uninstall_string_key).to eql "UninstallStringPath"
14
14
  end
@@ -16,14 +16,14 @@ describe Chef::Provider::Package::Windows::RegistryUninstallEntry do
16
16
 
17
17
  describe "when QuietUninstallString key present" do
18
18
  let(:quiet_uninstall_string) { "QuietUninstallString" }
19
- let (:quiet_uninstall_string_key) { Chef::Provider::Package::Windows::RegistryUninstallEntry.quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry).uninstall_string }
19
+ let(:quiet_uninstall_string_key) { Chef::Provider::Package::Windows::RegistryUninstallEntry.quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry).uninstall_string }
20
20
  it "returns QuietUninstallString key value" do
21
21
  expect(quiet_uninstall_string_key).to eql "QuietUninstallStringPath"
22
22
  end
23
23
  end
24
24
 
25
25
  describe ".find_entries", :windows_only do
26
- let (:registry_uninstall_entry) { Chef::Provider::Package::Windows::RegistryUninstallEntry }
26
+ let(:registry_uninstall_entry) { Chef::Provider::Package::Windows::RegistryUninstallEntry }
27
27
  before(:each) do
28
28
  allow_any_instance_of(::Win32::Registry).to receive(:open).and_return("::Win32::Registry::HKEY_CURRENT_USER")
29
29
  end
@@ -30,7 +30,7 @@ describe Chef::Provider::User::Dscl do
30
30
  let(:salt) { nil }
31
31
  let(:iterations) { nil }
32
32
 
33
- let (:events) { Chef::EventDispatch::Dispatcher.new }
33
+ let(:events) { Chef::EventDispatch::Dispatcher.new }
34
34
 
35
35
  let(:node) do
36
36
  Chef::Node.new.tap do |node|
@@ -39,7 +39,7 @@ describe Chef::Provider::User::Dscl do
39
39
  end
40
40
  end
41
41
 
42
- let (:run_context) { Chef::RunContext.new(node, {}, events) }
42
+ let(:run_context) { Chef::RunContext.new(node, {}, events) }
43
43
 
44
44
  let(:new_resource) do
45
45
  r = Chef::Resource::User::DsclUser.new("toor", run_context)
@@ -20,14 +20,15 @@ require "spec_helper"
20
20
 
21
21
  describe Chef::Provider::WindowsEnv, :windows_only do
22
22
 
23
+ let(:run_context) do
24
+ Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new)
25
+ end
26
+
23
27
  before do
24
- @node = Chef::Node.new
25
- @events = Chef::EventDispatch::Dispatcher.new
26
- @run_context = Chef::RunContext.new(@node, {}, @events)
27
28
  @new_resource = Chef::Resource::WindowsEnv.new("FOO")
28
29
  @new_resource.value("bar")
29
30
  @new_resource.user("<System>")
30
- @provider = Chef::Provider::WindowsEnv.new(@new_resource, @run_context)
31
+ @provider = Chef::Provider::WindowsEnv.new(@new_resource, run_context)
31
32
  end
32
33
 
33
34
  it "assumes the key_name exists by default" do
@@ -76,13 +76,19 @@ describe Chef::Resource::ChefClientCron do
76
76
  allow(provider).to receive(:splay_sleep_time).and_return("123")
77
77
  end
78
78
 
79
+ let(:root_path) { windows? ? "C:\\chef/client.rb" : "/etc/chef/client.rb" }
80
+
79
81
  it "creates a valid command if using all default properties" do
80
- expect(provider.cron_command).to eql("/bin/sleep 123; /opt/chef/bin/chef-client -c /etc/chef/client.rb -L /var/log/chef/client.log")
82
+ expect(provider.cron_command).to eql(
83
+ "/bin/sleep 123; /opt/chef/bin/chef-client -c #{root_path} -L /var/log/chef/client.log"
84
+ )
81
85
  end
82
86
 
83
87
  it "uses daemon_options if set" do
84
88
  resource.daemon_options ["--foo 1", "--bar 2"]
85
- expect(provider.cron_command).to eql("/bin/sleep 123; /opt/chef/bin/chef-client --foo 1 --bar 2 -c /etc/chef/client.rb -L /var/log/chef/client.log")
89
+ expect(provider.cron_command).to eql(
90
+ "/bin/sleep 123; /opt/chef/bin/chef-client --foo 1 --bar 2 -c #{root_path} -L /var/log/chef/client.log"
91
+ )
86
92
  end
87
93
 
88
94
  it "uses custom config dir if set" do
@@ -93,27 +99,37 @@ describe Chef::Resource::ChefClientCron do
93
99
  it "uses custom log files / paths if set" do
94
100
  resource.log_file_name "my-client.log"
95
101
  resource.log_directory "/var/log/my-chef/"
96
- expect(provider.cron_command).to eql("/bin/sleep 123; /opt/chef/bin/chef-client -c /etc/chef/client.rb -L /var/log/my-chef/my-client.log")
102
+ expect(provider.cron_command).to eql(
103
+ "/bin/sleep 123; /opt/chef/bin/chef-client -c #{root_path} -L /var/log/my-chef/my-client.log"
104
+ )
97
105
  end
98
106
 
99
107
  it "uses mailto if set" do
100
108
  resource.mailto "bob@example.com"
101
- expect(provider.cron_command).to eql("/bin/sleep 123; /opt/chef/bin/chef-client -c /etc/chef/client.rb -L /var/log/chef/client.log || echo \"Chef Infra Client execution failed\"")
109
+ expect(provider.cron_command).to eql(
110
+ "/bin/sleep 123; /opt/chef/bin/chef-client -c #{root_path} -L /var/log/chef/client.log || echo \"Chef Infra Client execution failed\""
111
+ )
102
112
  end
103
113
 
104
114
  it "uses custom chef-client binary if set" do
105
115
  resource.chef_binary_path "/usr/local/bin/chef-client"
106
- expect(provider.cron_command).to eql("/bin/sleep 123; /usr/local/bin/chef-client -c /etc/chef/client.rb -L /var/log/chef/client.log")
116
+ expect(provider.cron_command).to eql(
117
+ "/bin/sleep 123; /usr/local/bin/chef-client -c #{root_path} -L /var/log/chef/client.log"
118
+ )
107
119
  end
108
120
 
109
121
  it "appends to the log file appending if set to false" do
110
122
  resource.append_log_file false
111
- expect(provider.cron_command).to eql("/bin/sleep 123; /opt/chef/bin/chef-client -c /etc/chef/client.rb > /var/log/chef/client.log 2>&1")
123
+ expect(provider.cron_command).to eql(
124
+ "/bin/sleep 123; /opt/chef/bin/chef-client -c #{root_path} > /var/log/chef/client.log 2>&1"
125
+ )
112
126
  end
113
127
 
114
128
  it "sets the license acceptance flag if set" do
115
129
  resource.accept_chef_license true
116
- expect(provider.cron_command).to eql("/bin/sleep 123; /opt/chef/bin/chef-client -c /etc/chef/client.rb --chef-license accept -L /var/log/chef/client.log")
130
+ expect(provider.cron_command).to eql(
131
+ "/bin/sleep 123; /opt/chef/bin/chef-client -c #{root_path} --chef-license accept -L /var/log/chef/client.log"
132
+ )
117
133
  end
118
134
  end
119
135
  end
@@ -43,13 +43,16 @@ describe Chef::Resource::ChefClientSystemdTimer do
43
43
  end
44
44
 
45
45
  describe "#chef_client_cmd" do
46
+
47
+ let(:root_path) { windows? ? "C:\\chef/client.rb" : "/etc/chef/client.rb" }
48
+
46
49
  it "creates a valid command if using all default properties" do
47
- expect(provider.chef_client_cmd).to eql("/opt/chef/bin/chef-client -c /etc/chef/client.rb")
50
+ expect(provider.chef_client_cmd).to eql("/opt/chef/bin/chef-client -c #{root_path}")
48
51
  end
49
52
 
50
53
  it "uses daemon_options if set" do
51
54
  resource.daemon_options ["--foo 1", "--bar 2"]
52
- expect(provider.chef_client_cmd).to eql("/opt/chef/bin/chef-client --foo 1 --bar 2 -c /etc/chef/client.rb")
55
+ expect(provider.chef_client_cmd).to eql("/opt/chef/bin/chef-client --foo 1 --bar 2 -c #{root_path}")
53
56
  end
54
57
 
55
58
  it "uses custom config dir if set" do
@@ -59,12 +62,12 @@ describe Chef::Resource::ChefClientSystemdTimer do
59
62
 
60
63
  it "uses custom chef-client binary if set" do
61
64
  resource.chef_binary_path "/usr/local/bin/chef-client"
62
- expect(provider.chef_client_cmd).to eql("/usr/local/bin/chef-client -c /etc/chef/client.rb")
65
+ expect(provider.chef_client_cmd).to eql("/usr/local/bin/chef-client -c #{root_path}")
63
66
  end
64
67
 
65
68
  it "sets the license acceptance flag if set" do
66
69
  resource.accept_chef_license true
67
- expect(provider.chef_client_cmd).to eql("/opt/chef/bin/chef-client --chef-license accept -c /etc/chef/client.rb")
70
+ expect(provider.chef_client_cmd).to eql("/opt/chef/bin/chef-client --chef-license accept -c #{root_path}")
68
71
  end
69
72
  end
70
73
  end
@@ -112,7 +112,8 @@ describe Chef::Resource::File::Verification do
112
112
  end
113
113
 
114
114
  it "returns true if the command succeeds" do
115
- v = Chef::Resource::File::Verification.new(parent_resource, "true", {})
115
+ test_command = platform_specific_verify_command("path")
116
+ v = Chef::Resource::File::Verification.new(parent_resource, test_command, {})
116
117
  expect(v.verify(temp_path)).to eq(true)
117
118
  end
118
119
 
@@ -1255,19 +1255,36 @@ describe Chef::Resource do
1255
1255
  expect(block_value).to eq(original_umask)
1256
1256
  end
1257
1257
 
1258
- it "changes the umask in the block to the set value" do
1259
- resource.umask = "0123"
1258
+ if windows?
1259
+ it "is a no-op on Windows" do
1260
+ resource.umask = "0123"
1260
1261
 
1261
- block_value = nil
1262
+ block_value = nil
1262
1263
 
1263
- resource.with_umask do
1264
- block_value = ::File.umask
1264
+ resource.with_umask do
1265
+ block_value = ::File.umask
1266
+ end
1267
+
1268
+ # Format the returned value so a potential error message is easier to understand.
1269
+ actual_value = block_value.to_s(8).rjust(4, "0")
1270
+
1271
+ expect(actual_value).to eq("0000")
1265
1272
  end
1273
+ else
1274
+ it "changes the umask in the block to the set value" do
1275
+ resource.umask = "0123"
1276
+
1277
+ block_value = nil
1266
1278
 
1267
- # Format the returned value so a potential error message is easier to understand.
1268
- actual_value = block_value.to_s(8).rjust(4, "0")
1279
+ resource.with_umask do
1280
+ block_value = ::File.umask
1281
+ end
1269
1282
 
1270
- expect(actual_value).to eq("0123")
1283
+ # Format the returned value so a potential error message is easier to understand.
1284
+ actual_value = block_value.to_s(8).rjust(4, "0")
1285
+
1286
+ expect(actual_value).to eq("0123")
1287
+ end
1271
1288
  end
1272
1289
 
1273
1290
  it "resets the umask afterwards" do
@@ -310,50 +310,52 @@ describe Chef::Role do
310
310
  describe "when loading from disk and role_path is an array" do
311
311
 
312
312
  before(:each) do
313
- Chef::Config[:role_path] = ["/path1", "/path/path2"]
313
+ Chef::Config[:role_path] = ["/path1", "/path1/path2"]
314
314
  end
315
315
 
316
+ let(:root) { windows? ? "C:/path1" : "/path1" }
317
+
316
318
  it "should return a Chef::Role object from JSON" do
317
- expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return(["/path1/lolcat.json"])
318
- expect(File).to receive(:exists?).with("/path1/lolcat.json").exactly(1).times.and_return(true)
319
- expect(IO).to receive(:read).with("/path1/lolcat.json").and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
319
+ expect(Dir).to receive(:glob).with(File.join(root, "**", "**")).exactly(1).times.and_return(["#{root}/lolcat.json"])
320
+ expect(File).to receive(:exists?).with("#{root}/lolcat.json").exactly(1).times.and_return(true)
321
+ expect(IO).to receive(:read).with("#{root}/lolcat.json").and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
320
322
  expect(@role).to be_a_kind_of(Chef::Role)
321
323
  @role.class.from_disk("lolcat")
322
324
  end
323
325
 
324
326
  it "should return a Chef::Role object from JSON when role is in the second path" do
325
- expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return([])
326
- expect(Dir).to receive(:glob).with(File.join("/path/path2", "**", "**")).exactly(1).times.and_return(["/path/path2/lolcat.json"])
327
- expect(File).to receive(:exists?).with("/path/path2/lolcat.json").exactly(1).times.and_return(true)
328
- expect(IO).to receive(:read).with("/path/path2/lolcat.json").and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
327
+ expect(Dir).to receive(:glob).with(File.join(root, "**", "**")).exactly(1).times.and_return([])
328
+ expect(Dir).to receive(:glob).with(File.join("#{root}/path2", "**", "**")).exactly(1).times.and_return(["#{root}/path2/lolcat.json"])
329
+ expect(File).to receive(:exists?).with("#{root}/path2/lolcat.json").exactly(1).times.and_return(true)
330
+ expect(IO).to receive(:read).with("#{root}/path2/lolcat.json").and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
329
331
  expect(@role).to be_a_kind_of(Chef::Role)
330
332
  @role.class.from_disk("lolcat")
331
333
  end
332
334
 
333
335
  it "should return a Chef::Role object from a Ruby DSL" do
334
- expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return(["/path1/lolcat.rb"])
335
- expect(File).to receive(:exists?).with("/path1/lolcat.rb").exactly(1).times.and_return(true)
336
- expect(File).to receive(:readable?).with("/path1/lolcat.rb").and_return(true)
337
- expect(File).to receive(:file?).with("/path1/lolcat.rb").and_return(true)
338
- expect(IO).to receive(:read).with("/path1/lolcat.rb").exactly(1).times.and_return(ROLE_DSL)
336
+ expect(Dir).to receive(:glob).with(File.join(root, "**", "**")).exactly(1).times.and_return(["#{root}/lolcat.rb"])
337
+ expect(File).to receive(:exists?).with("#{root}/lolcat.rb").exactly(1).times.and_return(true)
338
+ expect(File).to receive(:readable?).with("#{root}/lolcat.rb").and_return(true)
339
+ expect(File).to receive(:file?).with("#{root}/lolcat.rb").and_return(true)
340
+ expect(IO).to receive(:read).with("#{root}/lolcat.rb").exactly(1).times.and_return(ROLE_DSL)
339
341
  expect(@role).to be_a_kind_of(Chef::Role)
340
342
  @role.class.from_disk("lolcat")
341
343
  end
342
344
 
343
345
  it "should return a Chef::Role object from a Ruby DSL when role is in the second path" do
344
- expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return([])
345
- expect(Dir).to receive(:glob).with(File.join("/path/path2", "**", "**")).exactly(1).times.and_return(["/path/path2/lolcat.rb"])
346
- expect(File).to receive(:exists?).with("/path/path2/lolcat.rb").exactly(1).times.and_return(true)
347
- expect(File).to receive(:readable?).with("/path/path2/lolcat.rb").and_return(true)
348
- expect(File).to receive(:file?).with("/path/path2/lolcat.rb").and_return(true)
349
- expect(IO).to receive(:read).with("/path/path2/lolcat.rb").exactly(1).times.and_return(ROLE_DSL)
346
+ expect(Dir).to receive(:glob).with(File.join(root, "**", "**")).exactly(1).times.and_return([])
347
+ expect(Dir).to receive(:glob).with(File.join("#{root}/path2", "**", "**")).exactly(1).times.and_return(["#{root}/path2/lolcat.rb"])
348
+ expect(File).to receive(:exists?).with("#{root}/path2/lolcat.rb").exactly(1).times.and_return(true)
349
+ expect(File).to receive(:readable?).with("#{root}/path2/lolcat.rb").and_return(true)
350
+ expect(File).to receive(:file?).with("#{root}/path2/lolcat.rb").and_return(true)
351
+ expect(IO).to receive(:read).with("#{root}/path2/lolcat.rb").exactly(1).times.and_return(ROLE_DSL)
350
352
  expect(@role).to be_a_kind_of(Chef::Role)
351
353
  @role.class.from_disk("lolcat")
352
354
  end
353
355
 
354
356
  it "should raise an exception if the file does not exist" do
355
- expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return([])
356
- expect(Dir).to receive(:glob).with(File.join("/path/path2", "**", "**")).exactly(1).times.and_return([])
357
+ expect(Dir).to receive(:glob).with(File.join(root, "**", "**")).exactly(1).times.and_return([])
358
+ expect(Dir).to receive(:glob).with(File.join("#{root}/path2", "**", "**")).exactly(1).times.and_return([])
357
359
  expect { @role.class.from_disk("lolcat") }.to raise_error(Chef::Exceptions::RoleNotFound)
358
360
  end
359
361
 
@@ -21,7 +21,7 @@ require "tmpdir"
21
21
 
22
22
  describe Chef::Util::Backup do
23
23
 
24
- let (:tempfile) do
24
+ let(:tempfile) do
25
25
  Tempfile.new("chef-util-backup-spec-test")
26
26
  end
27
27
 
@@ -20,8 +20,8 @@ require "chef"
20
20
  require "chef/util/powershell/ps_credential"
21
21
 
22
22
  describe Chef::Util::Powershell::PSCredential do
23
- let (:username) { "foo" }
24
- let (:password) { "ThIsIsThEpAsSwOrD" }
23
+ let(:username) { "foo" }
24
+ let(:password) { "ThIsIsThEpAsSwOrD" }
25
25
 
26
26
  context "when username and password are provided" do
27
27
  let(:ps_credential) { Chef::Util::Powershell::PSCredential.new(username, password) }
@@ -30,6 +30,7 @@ describe Chef::Util::Selinux do
30
30
  end
31
31
 
32
32
  before do
33
+ allow(ChefUtils).to receive(:windows?).and_return(false)
33
34
  TestClass.reset_state
34
35
  @test_instance = TestClass.new
35
36
  end
@@ -113,7 +114,7 @@ describe Chef::Util::Selinux do
113
114
  end
114
115
 
115
116
  describe "when restorecon binary exists on the system" do
116
- let (:path) { "/path/to/awesome directory" }
117
+ let(:path) { "/path/to/awesome directory" }
117
118
 
118
119
  before do
119
120
  @restorecon_enabled_path = File.join("/sbin", "restorecon")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.2.50
4
+ version: 16.2.73
5
5
  platform: universal-mingw32
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-23 00:00:00.000000000 Z
11
+ date: 2020-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 16.2.50
19
+ version: 16.2.73
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 16.2.50
26
+ version: 16.2.73
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef-utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 16.2.50
33
+ version: 16.2.73
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 16.2.50
40
+ version: 16.2.73
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -388,36 +388,42 @@ dependencies:
388
388
  name: diff-lcs
389
389
  requirement: !ruby/object:Gem::Requirement
390
390
  requirements:
391
- - - "~>"
392
- - !ruby/object:Gem::Version
393
- version: '1.2'
394
391
  - - ">="
395
392
  - !ruby/object:Gem::Version
396
393
  version: 1.2.4
394
+ - - "<"
395
+ - !ruby/object:Gem::Version
396
+ version: 1.4.0
397
397
  type: :runtime
398
398
  prerelease: false
399
399
  version_requirements: !ruby/object:Gem::Requirement
400
400
  requirements:
401
- - - "~>"
402
- - !ruby/object:Gem::Version
403
- version: '1.2'
404
401
  - - ">="
405
402
  - !ruby/object:Gem::Version
406
403
  version: 1.2.4
404
+ - - "<"
405
+ - !ruby/object:Gem::Version
406
+ version: 1.4.0
407
407
  - !ruby/object:Gem::Dependency
408
408
  name: ffi-libarchive
409
409
  requirement: !ruby/object:Gem::Requirement
410
410
  requirements:
411
+ - - "~>"
412
+ - !ruby/object:Gem::Version
413
+ version: '1.0'
411
414
  - - ">="
412
415
  - !ruby/object:Gem::Version
413
- version: '0'
416
+ version: 1.0.3
414
417
  type: :runtime
415
418
  prerelease: false
416
419
  version_requirements: !ruby/object:Gem::Requirement
417
420
  requirements:
421
+ - - "~>"
422
+ - !ruby/object:Gem::Version
423
+ version: '1.0'
418
424
  - - ">="
419
425
  - !ruby/object:Gem::Version
420
- version: '0'
426
+ version: 1.0.3
421
427
  - !ruby/object:Gem::Dependency
422
428
  name: chef-zero
423
429
  requirement: !ruby/object:Gem::Requirement
@@ -2080,7 +2086,6 @@ files:
2080
2086
  - spec/functional/resource/aix_service_spec.rb
2081
2087
  - spec/functional/resource/aixinit_service_spec.rb
2082
2088
  - spec/functional/resource/apt_package_spec.rb
2083
- - spec/functional/resource/base.rb
2084
2089
  - spec/functional/resource/bash_spec.rb
2085
2090
  - spec/functional/resource/batch_spec.rb
2086
2091
  - spec/functional/resource/bff_spec.rb
@@ -1,28 +0,0 @@
1
- #
2
- # Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
3
- # Copyright:: Copyright (c) Chef Software Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- def run_context
20
- @run_context ||= begin
21
- node = Chef::Node.new
22
- node.default[:platform] = ohai[:platform]
23
- node.default[:platform_version] = ohai[:platform_version]
24
- node.default[:os] = ohai[:os]
25
- events = Chef::EventDispatch::Dispatcher.new
26
- Chef::RunContext.new(node, {}, events)
27
- end
28
- end