chef 16.11.7-universal-mingw32 → 16.15.22-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +5 -2
- data/Rakefile +11 -0
- data/distro/ruby_bin_folder/AMD64/Chef.PowerShell.Wrapper.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/Chef.PowerShell.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/Newtonsoft.Json.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Chef.PowerShell.Wrapper.Core.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.pdb +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.NETCore.App.deps.json +153 -149
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Diagnostics.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Management.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Utility.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.ConsoleHost.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.CoreCLR.Eventing.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.MarkdownRender.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Security.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.WSMan.Management.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.WSMan.Runtime.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Newtonsoft.Json.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.Messages.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Drawing.Common.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Management.Automation.dll +0 -0
- data/distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.Pkcs.dll +0 -0
- data/distro/ruby_bin_folder/x86/Chef.PowerShell.dll +0 -0
- data/distro/ruby_bin_folder/x86/Chef.Powershell.Wrapper.dll +0 -0
- data/distro/ruby_bin_folder/x86/Newtonsoft.Json.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Chef.PowerShell.Wrapper.Core.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.pdb +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.NETCore.App.deps.json +153 -149
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Diagnostics.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Management.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Commands.Utility.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.ConsoleHost.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.CoreCLR.Eventing.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.MarkdownRender.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.PowerShell.Security.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.WSMan.Management.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Microsoft.WSMan.Runtime.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Newtonsoft.Json.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.Messages.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Drawing.Common.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Management.Automation.dll +0 -0
- data/distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.Pkcs.dll +0 -0
- data/lib/chef/cookbook/gem_installer.rb +5 -1
- data/lib/chef/cookbook_version.rb +26 -4
- data/lib/chef/data_collector/run_end_message.rb +1 -1
- data/lib/chef/deprecated.rb +14 -4
- data/lib/chef/exceptions.rb +3 -0
- data/lib/chef/formatters/error_mapper.rb +2 -2
- data/lib/chef/http.rb +5 -5
- data/lib/chef/knife/core/windows_bootstrap_context.rb +2 -3
- data/lib/chef/node.rb +20 -19
- data/lib/chef/policy_builder/policyfile.rb +5 -0
- data/lib/chef/provider/file.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +1 -1
- data/lib/chef/provider/mount.rb +7 -2
- data/lib/chef/provider/package/powershell.rb +5 -0
- data/lib/chef/provider/package/rubygems.rb +2 -2
- data/lib/chef/provider/service/macosx.rb +3 -3
- data/lib/chef/provider/template/content.rb +1 -1
- data/lib/chef/resource/chef_client_launchd.rb +1 -1
- data/lib/chef/resource/homebrew_cask.rb +13 -7
- data/lib/chef/resource/mount.rb +1 -1
- data/lib/chef/resource/rhsm_subscription.rb +5 -5
- data/lib/chef/resource/support/client.erb +6 -0
- data/lib/chef/resource/systemd_unit.rb +1 -1
- data/lib/chef/resource/user_ulimit.rb +1 -0
- data/lib/chef/resource/windows_security_policy.rb +55 -39
- data/lib/chef/resource/windows_uac.rb +3 -1
- data/lib/chef/resource/windows_user_privilege.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api.rb +9 -2
- data/spec/functional/resource/cron_spec.rb +1 -1
- data/spec/functional/resource/group_spec.rb +5 -1
- data/spec/functional/resource/link_spec.rb +8 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/platform_helpers.rb +4 -0
- data/spec/support/shared/unit/provider/file.rb +14 -0
- data/spec/unit/cookbook_version_spec.rb +52 -0
- data/spec/unit/data_collector_spec.rb +47 -1
- data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +3 -3
- data/spec/unit/policy_builder/policyfile_spec.rb +11 -1
- data/spec/unit/provider/mount/mount_spec.rb +51 -0
- data/spec/unit/provider/package/powershell_spec.rb +74 -12
- data/spec/unit/provider/package/rubygems_spec.rb +3 -3
- data/spec/unit/provider/service/macosx_spec.rb +3 -3
- data/spec/unit/resource/homebrew_cask_spec.rb +29 -11
- data/spec/unit/resource/mount_spec.rb +10 -0
- data/spec/unit/resource/rhsm_subscription_spec.rb +50 -3
- data/spec/unit/resource/systemd_unit_spec.rb +1 -1
- data/spec/unit/resource/user_ulimit_spec.rb +14 -1
- data/tasks/rspec.rb +1 -1
- metadata +9 -7
@@ -105,6 +105,10 @@ describe Chef::Provider::Package::Powershell, :windows_only, :windows_gte_10 do
|
|
105
105
|
let(:generated_install_cmdlet) { "#{tls_set_command} ( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
|
106
106
|
let(:generated_install_cmdlet_with_version) { "#{tls_set_command} ( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 ).Version" }
|
107
107
|
let(:generated_install_cmdlet_with_source) { "#{tls_set_command} ( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery ).Version" }
|
108
|
+
let(:generated_install_cmdlet_with_options) { "#{tls_set_command} ( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -AcceptLicense -Verbose ).Version" }
|
109
|
+
let(:generated_install_cmdlet_with_version_and_options) { "#{tls_set_command} ( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 -AcceptLicense -Verbose ).Version" }
|
110
|
+
let(:generated_install_cmdlet_with_source_and_options) { "#{tls_set_command} ( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -Source MyGallery -AcceptLicense -Verbose ).Version" }
|
111
|
+
let(:generated_install_cmdlet_with_source_and_version_and_options) { "#{tls_set_command} ( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 -Source MyGallery -AcceptLicense -Verbose ).Version" }
|
108
112
|
let(:generated_install_cmdlet_with_source_and_version) { "#{tls_set_command} ( Install-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 -Source MyGallery ).Version" }
|
109
113
|
let(:generated_uninstall_cmdlet) { "#{tls_set_command} ( Uninstall-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version" }
|
110
114
|
let(:generated_uninstall_cmdlet_with_version) { "#{tls_set_command} ( Uninstall-Package xNetworking -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 1.0.0.0 ).Version" }
|
@@ -204,11 +208,11 @@ describe Chef::Provider::Package::Powershell, :windows_only, :windows_gte_10 do
|
|
204
208
|
end
|
205
209
|
|
206
210
|
context "when source is nil" do
|
207
|
-
it "
|
211
|
+
it "builds get commands correctly" do
|
208
212
|
expect(provider.build_powershell_package_command("Get-Package xNetworking")).to eql(generated_get_cmdlet)
|
209
213
|
end
|
210
214
|
|
211
|
-
it "
|
215
|
+
it "builds get commands correctly when a version is passed" do
|
212
216
|
expect(provider.build_powershell_package_command("Get-Package xNetworking", "1.0.0.0")).to eql(generated_get_cmdlet_with_version)
|
213
217
|
end
|
214
218
|
|
@@ -220,30 +224,45 @@ describe Chef::Provider::Package::Powershell, :windows_only, :windows_gte_10 do
|
|
220
224
|
expect(provider.build_powershell_package_command("Find-Package xNetworking", "1.0.0.0")).to eql(generated_find_cmdlet_with_version)
|
221
225
|
end
|
222
226
|
|
223
|
-
it "
|
227
|
+
it "builds install commands correctly" do
|
224
228
|
expect(provider.build_powershell_package_command("Install-Package xNetworking")).to eql(generated_install_cmdlet)
|
225
229
|
end
|
226
230
|
|
227
|
-
it "
|
231
|
+
it "builds install commands correctly when a version is passed" do
|
228
232
|
expect(provider.build_powershell_package_command("Install-Package xNetworking", "1.0.0.0")).to eql(generated_install_cmdlet_with_version)
|
229
233
|
end
|
230
234
|
|
231
|
-
it "
|
235
|
+
it "builds install commands correctly when options are passed" do
|
236
|
+
new_resource.options("-AcceptLicense -Verbose")
|
237
|
+
expect(provider.build_powershell_package_command("Install-Package xNetworking")).to eql(generated_install_cmdlet_with_options)
|
238
|
+
end
|
239
|
+
|
240
|
+
it "builds install commands correctly when duplicate options are passed" do
|
241
|
+
new_resource.options("-WarningAction SilentlyContinue")
|
242
|
+
expect(provider.build_powershell_package_command("Install-Package xNetworking")).to eql(generated_install_cmdlet)
|
243
|
+
end
|
244
|
+
|
245
|
+
it "builds install commands correctly when a version and options are passed" do
|
246
|
+
new_resource.options("-AcceptLicense -Verbose")
|
247
|
+
expect(provider.build_powershell_package_command("Install-Package xNetworking", "1.0.0.0")).to eql(generated_install_cmdlet_with_version_and_options)
|
248
|
+
end
|
249
|
+
|
250
|
+
it "builds install commands correctly" do
|
232
251
|
expect(provider.build_powershell_package_command("Uninstall-Package xNetworking")).to eql(generated_uninstall_cmdlet)
|
233
252
|
end
|
234
253
|
|
235
|
-
it "
|
254
|
+
it "builds install commands correctly when a version is passed" do
|
236
255
|
expect(provider.build_powershell_package_command("Uninstall-Package xNetworking", "1.0.0.0")).to eql(generated_uninstall_cmdlet_with_version)
|
237
256
|
end
|
238
257
|
end
|
239
258
|
|
240
259
|
context "when source is set" do
|
241
|
-
it "
|
260
|
+
it "builds get commands correctly" do
|
242
261
|
new_resource.source("MyGallery")
|
243
262
|
expect(provider.build_powershell_package_command("Get-Package xNetworking")).to eql(generated_get_cmdlet)
|
244
263
|
end
|
245
264
|
|
246
|
-
it "
|
265
|
+
it "builds get commands correctly when a version is passed" do
|
247
266
|
new_resource.source("MyGallery")
|
248
267
|
expect(provider.build_powershell_package_command("Get-Package xNetworking", "1.0.0.0")).to eql(generated_get_cmdlet_with_version)
|
249
268
|
end
|
@@ -258,22 +277,40 @@ describe Chef::Provider::Package::Powershell, :windows_only, :windows_gte_10 do
|
|
258
277
|
expect(provider.build_powershell_package_command("Find-Package xNetworking", "1.0.0.0")).to eql(generated_find_cmdlet_with_source_and_version)
|
259
278
|
end
|
260
279
|
|
261
|
-
it "
|
280
|
+
it "builds install commands correctly" do
|
262
281
|
new_resource.source("MyGallery")
|
263
282
|
expect(provider.build_powershell_package_command("Install-Package xNetworking")).to eql(generated_install_cmdlet_with_source)
|
264
283
|
end
|
265
284
|
|
266
|
-
it "
|
285
|
+
it "builds install commands correctly when a version is passed" do
|
267
286
|
new_resource.source("MyGallery")
|
268
287
|
expect(provider.build_powershell_package_command("Install-Package xNetworking", "1.0.0.0")).to eql(generated_install_cmdlet_with_source_and_version)
|
269
288
|
end
|
270
289
|
|
271
|
-
it "
|
290
|
+
it "builds install commands correctly when options are passed" do
|
291
|
+
new_resource.source("MyGallery")
|
292
|
+
new_resource.options("-AcceptLicense -Verbose")
|
293
|
+
expect(provider.build_powershell_package_command("Install-Package xNetworking")).to eql(generated_install_cmdlet_with_source_and_options)
|
294
|
+
end
|
295
|
+
|
296
|
+
it "builds install commands correctly when duplicate options are passed" do
|
297
|
+
new_resource.source("MyGallery")
|
298
|
+
new_resource.options("-Force -ForceBootstrap")
|
299
|
+
expect(provider.build_powershell_package_command("Install-Package xNetworking")).to eql(generated_install_cmdlet_with_source)
|
300
|
+
end
|
301
|
+
|
302
|
+
it "builds install commands correctly when a version and options are passed" do
|
303
|
+
new_resource.source("MyGallery")
|
304
|
+
new_resource.options("-AcceptLicense -Verbose")
|
305
|
+
expect(provider.build_powershell_package_command("Install-Package xNetworking", "1.0.0.0")).to eql(generated_install_cmdlet_with_source_and_version_and_options)
|
306
|
+
end
|
307
|
+
|
308
|
+
it "builds install commands correctly" do
|
272
309
|
new_resource.source("MyGallery")
|
273
310
|
expect(provider.build_powershell_package_command("Uninstall-Package xNetworking")).to eql(generated_uninstall_cmdlet)
|
274
311
|
end
|
275
312
|
|
276
|
-
it "
|
313
|
+
it "builds install commands correctly when a version is passed" do
|
277
314
|
new_resource.source("MyGallery")
|
278
315
|
expect(provider.build_powershell_package_command("Uninstall-Package xNetworking", "1.0.0.0")).to eql(generated_uninstall_cmdlet_with_version)
|
279
316
|
end
|
@@ -434,6 +471,19 @@ describe Chef::Provider::Package::Powershell, :windows_only, :windows_gte_10 do
|
|
434
471
|
provider.run_action(:install)
|
435
472
|
expect(new_resource).to be_updated_by_last_action
|
436
473
|
end
|
474
|
+
|
475
|
+
it "should install a package using provided options" do
|
476
|
+
provider.load_current_resource
|
477
|
+
new_resource.package_name(["xCertificate"])
|
478
|
+
new_resource.version(nil)
|
479
|
+
new_resource.options(%w{-AcceptLicense -Verbose})
|
480
|
+
allow(provider).to receive(:powershell_out).with("#{tls_set_command} ( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
481
|
+
allow(provider).to receive(:powershell_out).with("#{tls_set_command} ( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
482
|
+
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
483
|
+
expect(provider).to receive(:powershell_out).with("#{tls_set_command} ( Install-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -RequiredVersion 2.1.0.0 -AcceptLicense -Verbose ).Version", { timeout: new_resource.timeout })
|
484
|
+
provider.run_action(:install)
|
485
|
+
expect(new_resource).to be_updated_by_last_action
|
486
|
+
end
|
437
487
|
end
|
438
488
|
|
439
489
|
describe "#action_remove" do
|
@@ -499,5 +549,17 @@ describe Chef::Provider::Package::Powershell, :windows_only, :windows_gte_10 do
|
|
499
549
|
provider.run_action(:remove)
|
500
550
|
expect(new_resource).to be_updated_by_last_action
|
501
551
|
end
|
552
|
+
|
553
|
+
it "should remove a package using provided options" do
|
554
|
+
new_resource.package_name(["xCertificate"])
|
555
|
+
new_resource.options(%w{-AllVersions})
|
556
|
+
allow(provider).to receive(:powershell_out).with("#{tls_set_command} ( Find-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
557
|
+
allow(provider).to receive(:powershell_out).with("#{tls_set_command} ( Get-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
|
558
|
+
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
|
559
|
+
provider.load_current_resource
|
560
|
+
expect(provider).to receive(:powershell_out).with("#{tls_set_command} ( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -WarningAction SilentlyContinue -AllVersions ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
|
561
|
+
provider.run_action(:remove)
|
562
|
+
expect(new_resource).to be_updated_by_last_action
|
563
|
+
end
|
502
564
|
end
|
503
565
|
end
|
@@ -482,10 +482,10 @@ describe Chef::Provider::Package::Rubygems do
|
|
482
482
|
end
|
483
483
|
end
|
484
484
|
|
485
|
-
context "when in omnibus
|
486
|
-
let(:bindir) { "/opt/
|
485
|
+
context "when in omnibus chef-workstation" do
|
486
|
+
let(:bindir) { "/opt/chef-workstation/embedded/bin" }
|
487
487
|
|
488
|
-
it "recognizes
|
488
|
+
it "recognizes chef-workstation as omnibus" do
|
489
489
|
expect(provider.is_omnibus?).to be true
|
490
490
|
end
|
491
491
|
end
|
@@ -78,7 +78,7 @@ describe Chef::Provider::Service::Macosx do
|
|
78
78
|
@getpwuid = double("Etc::Passwd", { name: "mikedodge04" })
|
79
79
|
allow(Etc).to receive(:getpwuid).and_return(@getpwuid)
|
80
80
|
allow(node).to receive(:[]).with("platform_version").and_return("10.11.1")
|
81
|
-
cmd = "launchctl list #{service_label}"
|
81
|
+
cmd = "/bin/launchctl list #{service_label}"
|
82
82
|
allow(provider).to receive(:shell_out)
|
83
83
|
.with(/(#{su_cmd} '#{cmd}'|#{cmd})/, default_env: false)
|
84
84
|
.and_return(double("Status",
|
@@ -265,7 +265,7 @@ describe Chef::Provider::Service::Macosx do
|
|
265
265
|
end
|
266
266
|
|
267
267
|
it "starts service via launchctl if service found" do
|
268
|
-
cmd = "launchctl load -w " + session + plist
|
268
|
+
cmd = "/bin/launchctl load -w " + session + plist
|
269
269
|
expect(provider).to receive(:shell_out)
|
270
270
|
.with(/(#{su_cmd} .#{cmd}.|#{cmd})/, default_env: false)
|
271
271
|
.and_return(0)
|
@@ -297,7 +297,7 @@ describe Chef::Provider::Service::Macosx do
|
|
297
297
|
end
|
298
298
|
|
299
299
|
it "stops the service via launchctl if service found" do
|
300
|
-
cmd = "launchctl unload -w " + plist
|
300
|
+
cmd = "/bin/launchctl unload -w " + plist
|
301
301
|
expect(provider).to receive(:shell_out)
|
302
302
|
.with(/(#{su_cmd} .#{cmd}.|#{cmd})/, default_env: false)
|
303
303
|
.and_return(0)
|
@@ -19,22 +19,40 @@ require "spec_helper"
|
|
19
19
|
|
20
20
|
describe Chef::Resource::HomebrewCask do
|
21
21
|
|
22
|
-
|
22
|
+
context "name with under bar" do
|
23
|
+
let(:resource) { Chef::Resource::HomebrewCask.new("fakey_fakerton") }
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
it "has a resource name of :homebrew_cask" do
|
26
|
+
expect(resource.resource_name).to eql(:homebrew_cask)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "the cask_name property is the name_property" do
|
30
|
+
expect(resource.cask_name).to eql("fakey_fakerton")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "sets the default action as :install" do
|
34
|
+
expect(resource.action).to eql([:install])
|
35
|
+
end
|
27
36
|
|
28
|
-
|
29
|
-
|
37
|
+
it "supports :install, :remove actions" do
|
38
|
+
expect { resource.action :install }.not_to raise_error
|
39
|
+
expect { resource.action :remove }.not_to raise_error
|
40
|
+
end
|
30
41
|
end
|
31
42
|
|
32
|
-
|
33
|
-
|
43
|
+
context "name with high fun" do
|
44
|
+
let(:resource) { Chef::Resource::HomebrewCask.new("fakey-fakerton") }
|
45
|
+
|
46
|
+
it "the cask_name property is the name_property" do
|
47
|
+
expect(resource.cask_name).to eql("fakey-fakerton")
|
48
|
+
end
|
34
49
|
end
|
35
50
|
|
36
|
-
|
37
|
-
|
38
|
-
|
51
|
+
context "name with at mark" do
|
52
|
+
let(:resource) { Chef::Resource::HomebrewCask.new("fakey-fakerton@10") }
|
53
|
+
|
54
|
+
it "the cask_name property is the name_property" do
|
55
|
+
expect(resource.cask_name).to eql("fakey-fakerton@10")
|
56
|
+
end
|
39
57
|
end
|
40
58
|
end
|
@@ -59,6 +59,16 @@ describe Chef::Resource::Mount do
|
|
59
59
|
expect(resource.mount_point).to eql("//192.168.11.102/Share/backup")
|
60
60
|
end
|
61
61
|
|
62
|
+
it "does not strip slash when mount_point is root directory" do
|
63
|
+
resource.mount_point "/"
|
64
|
+
expect(resource.mount_point).to eql("/")
|
65
|
+
end
|
66
|
+
|
67
|
+
it "does not strip slash when mount_point is root of network mount" do
|
68
|
+
resource.mount_point "127.0.0.1:/"
|
69
|
+
expect(resource.mount_point).to eql("127.0.0.1:/")
|
70
|
+
end
|
71
|
+
|
62
72
|
it "raises error when mount_point property is not set" do
|
63
73
|
expect { resource.mount_point nil }.to raise_error(Chef::Exceptions::ValidationFailed, "Property mount_point must be one of: String! You passed nil.")
|
64
74
|
end
|
@@ -18,15 +18,24 @@
|
|
18
18
|
require "spec_helper"
|
19
19
|
|
20
20
|
describe Chef::Resource::RhsmSubscription do
|
21
|
-
let(:
|
22
|
-
let(:
|
21
|
+
let(:event_dispatch) { Chef::EventDispatch::Dispatcher.new }
|
22
|
+
let(:node) { Chef::Node.new }
|
23
|
+
let(:run_context) { Chef::RunContext.new(node, {}, event_dispatch) }
|
24
|
+
|
25
|
+
let(:pool_id) { "8a8dd78c766232550226b46e59404aba" }
|
26
|
+
let(:resource) { Chef::Resource::RhsmSubscription.new(pool_id, run_context) }
|
27
|
+
let(:provider) { resource.provider_for_action(Array(resource.action).first) }
|
28
|
+
|
29
|
+
before do
|
30
|
+
allow(resource).to receive(:provider_for_action).with(:attach).and_return(provider)
|
31
|
+
end
|
23
32
|
|
24
33
|
it "has a resource name of :rhsm_subscription" do
|
25
34
|
expect(resource.resource_name).to eql(:rhsm_subscription)
|
26
35
|
end
|
27
36
|
|
28
37
|
it "the pool_id property is the name_property" do
|
29
|
-
expect(resource.pool_id).to eql(
|
38
|
+
expect(resource.pool_id).to eql(pool_id)
|
30
39
|
end
|
31
40
|
|
32
41
|
it "sets the default action as :attach" do
|
@@ -38,6 +47,44 @@ describe Chef::Resource::RhsmSubscription do
|
|
38
47
|
expect { resource.action :remove }.not_to raise_error
|
39
48
|
end
|
40
49
|
|
50
|
+
describe "#action_attach" do
|
51
|
+
let(:yum_package_double) { instance_double("Chef::Resource::YumPackage") }
|
52
|
+
let(:so_double) { instance_double("Mixlib::ShellOut", stdout: "Successfully attached a subscription for: My Subscription", exitstatus: 0, error?: false) }
|
53
|
+
|
54
|
+
before do
|
55
|
+
allow(provider).to receive(:shell_out!).with("subscription-manager attach --pool=#{resource.pool_id}").and_return(so_double)
|
56
|
+
allow(provider).to receive(:build_resource).with(:package, "rhsm_subscription-#{pool_id}-flush_cache").and_return(yum_package_double)
|
57
|
+
allow(yum_package_double).to receive(:run_action).with(:flush_cache)
|
58
|
+
end
|
59
|
+
|
60
|
+
context "when already attached to pool" do
|
61
|
+
before do
|
62
|
+
allow(provider).to receive(:subscription_attached?).with(resource.pool_id).and_return(true)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "does not attach to pool" do
|
66
|
+
expect(provider).not_to receive(:shell_out!)
|
67
|
+
resource.run_action(:attach)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "when not attached to pool" do
|
72
|
+
before do
|
73
|
+
allow(provider).to receive(:subscription_attached?).with(resource.pool_id).and_return(false)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "attaches to pool" do
|
77
|
+
expect(provider).to receive(:shell_out!).with("subscription-manager attach --pool=#{resource.pool_id}")
|
78
|
+
resource.run_action(:attach)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "flushes package provider cache" do
|
82
|
+
expect(yum_package_double).to receive(:run_action).with(:flush_cache)
|
83
|
+
resource.run_action(:attach)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
41
88
|
describe "#subscription_attached?" do
|
42
89
|
let(:cmd) { double("cmd") }
|
43
90
|
let(:output) { "Pool ID: pool123" }
|
@@ -20,7 +20,7 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Chef::Resource::SystemdUnit do
|
22
22
|
let(:resource) { Chef::Resource::SystemdUnit.new("sysstat-collect.timer") }
|
23
|
-
let(:unit_content_string) { "[Unit]\nDescription
|
23
|
+
let(:unit_content_string) { "[Unit]\nDescription=Run system activity accounting tool every 10 minutes\nDocumentation=foo\nDocumentation=bar\n\n[Timer]\nOnCalendar=*:00/10\n\n[Install]\nWantedBy=sysstat.service\n" }
|
24
24
|
let(:unit_content_hash) do
|
25
25
|
{
|
26
26
|
"Unit" => {
|
@@ -17,7 +17,6 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "spec_helper"
|
20
|
-
|
21
20
|
describe Chef::Resource::UserUlimit do
|
22
21
|
let(:node) { Chef::Node.new }
|
23
22
|
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
@@ -50,4 +49,18 @@ describe Chef::Resource::UserUlimit do
|
|
50
49
|
expect { resource.action :create }.not_to raise_error
|
51
50
|
expect { resource.action :delete }.not_to raise_error
|
52
51
|
end
|
52
|
+
|
53
|
+
describe "sensitive attribute" do
|
54
|
+
context "should be insensitive by default" do
|
55
|
+
it { expect(resource.sensitive).to(be_falsey) }
|
56
|
+
end
|
57
|
+
|
58
|
+
context "when set" do
|
59
|
+
before { resource.sensitive(true) }
|
60
|
+
|
61
|
+
it "should be set on the resource" do
|
62
|
+
expect(resource.sensitive).to(be_truthy)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
53
66
|
end
|
data/tasks/rspec.rb
CHANGED
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.
|
4
|
+
version: 16.15.22
|
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: 2021-
|
11
|
+
date: 2021-09-20 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.
|
19
|
+
version: 16.15.22
|
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.
|
26
|
+
version: 16.15.22
|
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.
|
33
|
+
version: 16.15.22
|
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.
|
40
|
+
version: 16.15.22
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -852,6 +852,7 @@ files:
|
|
852
852
|
- distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Contracts.dll
|
853
853
|
- distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Debug.dll
|
854
854
|
- distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.DiagnosticSource.dll
|
855
|
+
- distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.Messages.dll
|
855
856
|
- distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.dll
|
856
857
|
- distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.FileVersionInfo.dll
|
857
858
|
- distro/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Process.dll
|
@@ -1156,6 +1157,7 @@ files:
|
|
1156
1157
|
- distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Contracts.dll
|
1157
1158
|
- distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Debug.dll
|
1158
1159
|
- distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.DiagnosticSource.dll
|
1160
|
+
- distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.Messages.dll
|
1159
1161
|
- distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.EventLog.dll
|
1160
1162
|
- distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.FileVersionInfo.dll
|
1161
1163
|
- distro/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Process.dll
|
@@ -3555,7 +3557,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
3555
3557
|
- !ruby/object:Gem::Version
|
3556
3558
|
version: '0'
|
3557
3559
|
requirements: []
|
3558
|
-
rubygems_version: 3.1.
|
3560
|
+
rubygems_version: 3.1.6
|
3559
3561
|
signing_key:
|
3560
3562
|
specification_version: 4
|
3561
3563
|
summary: A systems integration framework, built to bring the benefits of configuration
|