chef 15.8.23-universal-mingw32 → 15.9.17-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.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -2
  3. data/README.md +1 -1
  4. data/Rakefile +9 -0
  5. data/distro/powershell/chef/chef.psm1 +459 -459
  6. data/distro/templates/powershell/chef/chef.psm1.erb +459 -0
  7. data/lib/chef/application.rb +1 -1
  8. data/lib/chef/chef_fs/chef_fs_data_store.rb +1 -1
  9. data/lib/chef/chef_fs/command_line.rb +5 -5
  10. data/lib/chef/cookbook/metadata.rb +5 -4
  11. data/lib/chef/cookbook/synchronizer.rb +1 -0
  12. data/lib/chef/cookbook_loader.rb +1 -1
  13. data/lib/chef/data_collector/config_validation.rb +7 -7
  14. data/lib/chef/deprecated.rb +5 -5
  15. data/lib/chef/dsl/platform_introspection.rb +2 -2
  16. data/lib/chef/dsl/reboot_pending.rb +3 -3
  17. data/lib/chef/http/json_output.rb +1 -1
  18. data/lib/chef/knife.rb +1 -1
  19. data/lib/chef/knife/bootstrap/templates/README.md +2 -2
  20. data/lib/chef/knife/bootstrap/templates/chef-full.erb +9 -9
  21. data/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +2 -2
  22. data/lib/chef/knife/core/ui.rb +1 -1
  23. data/lib/chef/knife/core/windows_bootstrap_context.rb +8 -8
  24. data/lib/chef/knife/data_bag_edit.rb +2 -2
  25. data/lib/chef/knife/edit.rb +1 -1
  26. data/lib/chef/knife/environment_compare.rb +1 -1
  27. data/lib/chef/knife/list.rb +1 -1
  28. data/lib/chef/mixin/api_version_request_handling.rb +1 -1
  29. data/lib/chef/provider/group/usermod.rb +2 -5
  30. data/lib/chef/provider/mount/mount.rb +1 -1
  31. data/lib/chef/provider/package/homebrew.rb +1 -2
  32. data/lib/chef/provider/package/rubygems.rb +1 -1
  33. data/lib/chef/provider/package/yum/python_helper.rb +2 -2
  34. data/lib/chef/provider/package/yum/rpm_utils.rb +4 -4
  35. data/lib/chef/provider/package/zypper.rb +2 -1
  36. data/lib/chef/provider/remote_file.rb +2 -2
  37. data/lib/chef/provider/route.rb +4 -4
  38. data/lib/chef/provider/windows_env.rb +3 -3
  39. data/lib/chef/resource.rb +7 -2
  40. data/lib/chef/resource/build_essential.rb +46 -22
  41. data/lib/chef/resource/cron.rb +1 -1
  42. data/lib/chef/resource/cron_d.rb +1 -1
  43. data/lib/chef/resource/execute.rb +1 -1
  44. data/lib/chef/resource/freebsd_package.rb +0 -3
  45. data/lib/chef/resource/homebrew_package.rb +1 -2
  46. data/lib/chef/resource/hostname.rb +2 -2
  47. data/lib/chef/resource/kernel_module.rb +3 -2
  48. data/lib/chef/resource/openbsd_package.rb +0 -3
  49. data/lib/chef/resource/remote_file.rb +1 -1
  50. data/lib/chef/resource/rhsm_errata.rb +9 -2
  51. data/lib/chef/resource/rhsm_errata_level.rb +11 -5
  52. data/lib/chef/resource/rhsm_register.rb +27 -12
  53. data/lib/chef/resource/swap_file.rb +2 -2
  54. data/lib/chef/resource/timezone.rb +2 -2
  55. data/lib/chef/resource/windows_certificate.rb +0 -2
  56. data/lib/chef/resource/windows_share.rb +1 -1
  57. data/lib/chef/shell/ext.rb +1 -1
  58. data/lib/chef/util/diff.rb +3 -3
  59. data/lib/chef/util/selinux.rb +2 -2
  60. data/lib/chef/version.rb +1 -1
  61. data/lib/chef/win32/error.rb +1 -1
  62. data/lib/chef/win32/registry.rb +1 -1
  63. data/spec/data/cookbooks/starter/recipes/default.rb +1 -1
  64. data/spec/data/windows_certificates/base64_test.cer +18 -20
  65. data/spec/data/windows_certificates/othertest.cer +0 -0
  66. data/spec/data/windows_certificates/test.cer +0 -0
  67. data/spec/data/windows_certificates/test.p7b +0 -0
  68. data/spec/data/windows_certificates/test.pem +18 -19
  69. data/spec/data/windows_certificates/test.pfx +0 -0
  70. data/spec/functional/resource/ifconfig_spec.rb +2 -2
  71. data/spec/functional/resource/windows_certificate_spec.rb +9 -9
  72. data/spec/functional/resource/windows_service_spec.rb +1 -2
  73. data/spec/functional/run_lock_spec.rb +7 -1
  74. data/spec/functional/win32/service_manager_spec.rb +1 -1
  75. data/spec/functional/win32/version_info_spec.rb +4 -4
  76. data/spec/integration/client/client_spec.rb +2 -2
  77. data/spec/integration/client/exit_code_spec.rb +1 -0
  78. data/spec/integration/client/ipv6_spec.rb +1 -0
  79. data/spec/integration/knife/chef_fs_data_store_spec.rb +1 -0
  80. data/spec/integration/knife/chef_repo_path_spec.rb +1 -0
  81. data/spec/integration/knife/chef_repository_file_system_spec.rb +1 -0
  82. data/spec/integration/knife/chefignore_spec.rb +1 -0
  83. data/spec/integration/knife/client_bulk_delete_spec.rb +1 -0
  84. data/spec/integration/knife/client_create_spec.rb +1 -0
  85. data/spec/integration/knife/client_delete_spec.rb +1 -0
  86. data/spec/integration/knife/client_key_create_spec.rb +1 -0
  87. data/spec/integration/knife/client_key_delete_spec.rb +1 -0
  88. data/spec/integration/knife/client_key_list_spec.rb +1 -0
  89. data/spec/integration/knife/client_key_show_spec.rb +1 -0
  90. data/spec/integration/knife/client_list_spec.rb +1 -0
  91. data/spec/integration/knife/client_show_spec.rb +1 -0
  92. data/spec/integration/knife/common_options_spec.rb +1 -0
  93. data/spec/integration/knife/config_get_profile_spec.rb +1 -0
  94. data/spec/integration/knife/config_get_spec.rb +1 -0
  95. data/spec/integration/knife/config_list_profiles_spec.rb +1 -0
  96. data/spec/integration/knife/config_use_profile_spec.rb +1 -0
  97. data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -0
  98. data/spec/integration/knife/cookbook_bulk_delete_spec.rb +1 -0
  99. data/spec/integration/knife/cookbook_download_spec.rb +1 -0
  100. data/spec/integration/knife/cookbook_list_spec.rb +1 -0
  101. data/spec/integration/knife/cookbook_show_spec.rb +1 -0
  102. data/spec/integration/knife/cookbook_upload_spec.rb +1 -0
  103. data/spec/integration/knife/data_bag_create_spec.rb +1 -0
  104. data/spec/integration/knife/data_bag_delete_spec.rb +1 -0
  105. data/spec/integration/knife/data_bag_edit_spec.rb +1 -0
  106. data/spec/integration/knife/data_bag_from_file_spec.rb +1 -0
  107. data/spec/integration/knife/data_bag_list_spec.rb +1 -0
  108. data/spec/integration/knife/data_bag_show_spec.rb +1 -0
  109. data/spec/integration/knife/delete_spec.rb +1 -0
  110. data/spec/integration/knife/deps_spec.rb +3 -2
  111. data/spec/integration/knife/diff_spec.rb +1 -0
  112. data/spec/integration/knife/download_spec.rb +1 -0
  113. data/spec/integration/knife/environment_compare_spec.rb +1 -0
  114. data/spec/integration/knife/environment_create_spec.rb +1 -0
  115. data/spec/integration/knife/environment_delete_spec.rb +1 -0
  116. data/spec/integration/knife/environment_from_file_spec.rb +1 -0
  117. data/spec/integration/knife/environment_list_spec.rb +1 -0
  118. data/spec/integration/knife/environment_show_spec.rb +1 -0
  119. data/spec/integration/knife/list_spec.rb +1 -0
  120. data/spec/integration/knife/node_bulk_delete_spec.rb +1 -0
  121. data/spec/integration/knife/node_create_spec.rb +1 -0
  122. data/spec/integration/knife/node_delete_spec.rb +1 -0
  123. data/spec/integration/knife/node_environment_set_spec.rb +1 -0
  124. data/spec/integration/knife/node_from_file_spec.rb +1 -0
  125. data/spec/integration/knife/node_list_spec.rb +1 -0
  126. data/spec/integration/knife/node_run_list_add_spec.rb +1 -0
  127. data/spec/integration/knife/node_run_list_remove_spec.rb +1 -0
  128. data/spec/integration/knife/node_run_list_set_spec.rb +1 -0
  129. data/spec/integration/knife/node_show_spec.rb +1 -0
  130. data/spec/integration/knife/raw_spec.rb +1 -0
  131. data/spec/integration/knife/redirection_spec.rb +1 -0
  132. data/spec/integration/knife/role_bulk_delete_spec.rb +1 -0
  133. data/spec/integration/knife/role_create_spec.rb +1 -0
  134. data/spec/integration/knife/role_delete_spec.rb +1 -0
  135. data/spec/integration/knife/role_from_file_spec.rb +1 -0
  136. data/spec/integration/knife/role_list_spec.rb +1 -0
  137. data/spec/integration/knife/role_show_spec.rb +1 -0
  138. data/spec/integration/knife/search_node_spec.rb +1 -0
  139. data/spec/integration/knife/show_spec.rb +1 -0
  140. data/spec/integration/knife/upload_spec.rb +1 -0
  141. data/spec/integration/recipes/accumulator_spec.rb +1 -0
  142. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -0
  143. data/spec/integration/recipes/lwrp_spec.rb +1 -0
  144. data/spec/integration/recipes/notifies_spec.rb +1 -0
  145. data/spec/integration/recipes/notifying_block_spec.rb +1 -0
  146. data/spec/integration/recipes/recipe_dsl_spec.rb +1 -0
  147. data/spec/integration/recipes/resource_action_spec.rb +1 -0
  148. data/spec/integration/recipes/unified_mode_spec.rb +1 -0
  149. data/spec/integration/solo/solo_spec.rb +1 -0
  150. data/spec/spec_helper.rb +7 -10
  151. data/spec/support/chef_helpers.rb +1 -1
  152. data/spec/support/key_helpers.rb +0 -2
  153. data/spec/support/platform_helpers.rb +7 -3
  154. data/spec/support/platforms/win32/spec_service.rb +27 -25
  155. data/spec/support/shared/context/config.rb +0 -3
  156. data/spec/support/shared/integration/integration_helper.rb +0 -1
  157. data/spec/support/shared/unit/execute_resource.rb +0 -2
  158. data/spec/support/shared/unit/provider/file.rb +0 -1
  159. data/spec/support/shared/unit/script_resource.rb +2 -4
  160. data/spec/support/shared/unit/windows_script_resource.rb +0 -2
  161. data/spec/unit/cookbook/gem_installer_spec.rb +1 -1
  162. data/spec/unit/cookbook/metadata_spec.rb +1 -10
  163. data/spec/unit/data_collector_spec.rb +1 -1
  164. data/spec/unit/deprecated_spec.rb +3 -3
  165. data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +1 -1
  166. data/spec/unit/encrypted_data_bag_item_spec.rb +2 -2
  167. data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +3 -3
  168. data/spec/unit/knife_spec.rb +6 -7
  169. data/spec/unit/mixin/shell_out_spec.rb +27 -29
  170. data/spec/unit/provider/file_spec.rb +1 -0
  171. data/spec/unit/resource/build_essential_spec.rb +48 -2
  172. data/spec/unit/resource/data/InstallHistory_with_CLT.plist +92 -0
  173. data/spec/unit/resource/data/InstallHistory_without_CLT.plist +38 -0
  174. data/spec/unit/resource/execute_spec.rb +1 -1
  175. data/spec/unit/resource/rhsm_register_spec.rb +24 -0
  176. data/spec/unit/resource/windows_share_spec.rb +3 -1
  177. data/tasks/rspec.rb +1 -0
  178. metadata +9 -6
@@ -626,7 +626,7 @@ describe Chef::DataCollector do
626
626
  it "collects deprecation messages" do
627
627
  location = Chef::Log.caller_location
628
628
  events.deprecation(Chef::Deprecated.create(:internal_api, "deprecation warning", location))
629
- expect_converge_message("deprecations" => [{ location: location, message: "deprecation warning", url: "https://docs.chef.io/deprecations_internal_api.html" }])
629
+ expect_converge_message("deprecations" => [{ location: location, message: "deprecation warning", url: "https://docs.chef.io/deprecations_internal_api/" }])
630
630
  send_run_failed_or_completed_event
631
631
  end
632
632
  end
@@ -20,7 +20,7 @@ require "chef/deprecated"
20
20
 
21
21
  describe Chef::Deprecated do
22
22
  class TestDeprecation < Chef::Deprecated::Base
23
- target 999, "test.html"
23
+ target 999, "test"
24
24
  end
25
25
 
26
26
  context "loading a deprecation class" do
@@ -44,11 +44,11 @@ describe Chef::Deprecated do
44
44
  let(:location) { "the location" }
45
45
 
46
46
  it "displays the full URL" do
47
- expect(TestDeprecation.new.url).to eql("https://docs.chef.io/deprecations_test.html")
47
+ expect(TestDeprecation.new.url).to eql("https://docs.chef.io/deprecations_test/")
48
48
  end
49
49
 
50
50
  it "formats a complete deprecation message" do
51
- expect(TestDeprecation.new(message, location).to_s).to eql("Deprecation CHEF-999 from the location\n\n A test message\n\nPlease see https://docs.chef.io/deprecations_test.html for further details and information on how to correct this problem.")
51
+ expect(TestDeprecation.new(message, location).to_s).to eql("Deprecation CHEF-999 from the location\n\n A test message\n\nPlease see https://docs.chef.io/deprecations_test/ for further details and information on how to correct this problem.")
52
52
  end
53
53
  end
54
54
 
@@ -85,7 +85,7 @@ describe Chef::EncryptedDataBagItem::CheckEncrypted do
85
85
  end
86
86
  end
87
87
 
88
- context "when encryption version is 3", :aes_256_gcm_only, ruby: "~> 2.0.0" do
88
+ context "when encryption version is 3", :aes_256_gcm_only do
89
89
  include_examples "encryption detected" do
90
90
  let(:version) { 3 }
91
91
  let(:encryptor) { Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor }
@@ -97,7 +97,7 @@ describe Chef::EncryptedDataBagItem::Encryptor do
97
97
  Chef::Config[:data_bag_encrypt_version] = 3
98
98
  end
99
99
 
100
- context "on supported platforms", :aes_256_gcm_only, ruby: "~> 2.0.0" do
100
+ context "on supported platforms", :aes_256_gcm_only do
101
101
 
102
102
  it "creates a version 3 encryptor" do
103
103
  expect(encryptor).to be_a_instance_of(Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor)
@@ -166,7 +166,7 @@ describe Chef::EncryptedDataBagItem::Decryptor do
166
166
 
167
167
  context "when decrypting a version 3 (JSON+aes-256-gcm+random iv+auth tag) encrypted value" do
168
168
 
169
- context "on supported platforms", :aes_256_gcm_only, ruby: "~> 2.0.0" do
169
+ context "on supported platforms", :aes_256_gcm_only do
170
170
 
171
171
  let(:encrypted_value) do
172
172
  Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor.new(plaintext_data, encryption_key).for_encrypted_item
@@ -164,9 +164,9 @@ describe Chef::Knife::Core::WindowsBootstrapContext do
164
164
  expected = <<~EXPECTED
165
165
  echo.chef_server_url "http://chef.example.com:4444"
166
166
  echo.validation_client_name "chef-validator-testing"
167
- echo.file_cache_path "c:/chef/cache"
168
- echo.file_backup_path "c:/chef/backup"
169
- echo.cache_options ^({:path =^> "c:/chef/cache/checksums", :skip_expires =^> true}^)
167
+ echo.file_cache_path "C:/chef/cache"
168
+ echo.file_backup_path "C:/chef/backup"
169
+ echo.cache_options ^({:path =^> "C:/chef/cache/checksums", :skip_expires =^> true}^)
170
170
  echo.# Using default node name ^(fqdn^)
171
171
  echo.log_level :info
172
172
  echo.log_location STDOUT
@@ -418,13 +418,10 @@ describe Chef::Knife do
418
418
 
419
419
  describe "when first created" do
420
420
 
421
- let(:knife) { KnifeSpecs::TestYourself.new(%w{with some args -s scrogramming}) }
422
-
423
- before do
424
- unless KnifeSpecs.const_defined?(:TestYourself)
425
- Kernel.load(File.join(CHEF_SPEC_DATA, "knife_subcommand", "test_yourself.rb"))
426
- end
427
- end
421
+ let(:knife) {
422
+ Kernel.load "spec/data/knife_subcommand/test_yourself.rb"
423
+ KnifeSpecs::TestYourself.new(%w{with some args -s scrogramming})
424
+ }
428
425
 
429
426
  it "it parses the options passed to it" do
430
427
  expect(knife.config[:scro]).to eq("scrogramming")
@@ -435,6 +432,8 @@ describe Chef::Knife do
435
432
  end
436
433
 
437
434
  it "does not have lazy dependencies loaded" do
435
+ skip "unstable with randomization... prolly needs more isolation"
436
+
438
437
  expect(knife.class.test_deps_loaded).not_to be_truthy
439
438
  end
440
439
  end
@@ -246,35 +246,33 @@ describe Chef::Mixin::ShellOut do
246
246
  let(:new_resource) { CustomResource.new("foo") }
247
247
  let(:provider) { new_resource.provider_for_action(:install) }
248
248
 
249
- describe "on Chef-15", chef: ">= 15" do
250
- %i{shell_out shell_out!}.each do |method|
251
- stubbed_method = (method == :shell_out) ? :shell_out_compacted : :shell_out_compacted!
252
- it "#{method} defaults to 900 seconds" do
253
- expect(provider).to receive(stubbed_method).with("foo", timeout: 900)
254
- provider.send(method, "foo")
255
- end
256
- it "#{method} overrides the default timeout with its options" do
257
- expect(provider).to receive(stubbed_method).with("foo", timeout: 1)
258
- provider.send(method, "foo", timeout: 1)
259
- end
260
- it "#{method} overrides the new_resource.timeout with the timeout option" do
261
- new_resource.timeout(99)
262
- expect(provider).to receive(stubbed_method).with("foo", timeout: 1)
263
- provider.send(method, "foo", timeout: 1)
264
- end
265
- it "#{method} defaults to 900 seconds and preserves options" do
266
- expect(provider).to receive(stubbed_method).with("foo", env: nil, timeout: 900)
267
- provider.send(method, "foo", env: nil)
268
- end
269
- it "#{method} overrides the default timeout with its options and preserves options" do
270
- expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil)
271
- provider.send(method, "foo", timeout: 1, env: nil)
272
- end
273
- it "#{method} overrides the new_resource.timeout with the timeout option and preseves options" do
274
- new_resource.timeout(99)
275
- expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil)
276
- provider.send(method, "foo", timeout: 1, env: nil)
277
- end
249
+ %i{shell_out shell_out!}.each do |method|
250
+ stubbed_method = (method == :shell_out) ? :shell_out_compacted : :shell_out_compacted!
251
+ it "#{method} defaults to 900 seconds" do
252
+ expect(provider).to receive(stubbed_method).with("foo", timeout: 900)
253
+ provider.send(method, "foo")
254
+ end
255
+ it "#{method} overrides the default timeout with its options" do
256
+ expect(provider).to receive(stubbed_method).with("foo", timeout: 1)
257
+ provider.send(method, "foo", timeout: 1)
258
+ end
259
+ it "#{method} overrides the new_resource.timeout with the timeout option" do
260
+ new_resource.timeout(99)
261
+ expect(provider).to receive(stubbed_method).with("foo", timeout: 1)
262
+ provider.send(method, "foo", timeout: 1)
263
+ end
264
+ it "#{method} defaults to 900 seconds and preserves options" do
265
+ expect(provider).to receive(stubbed_method).with("foo", env: nil, timeout: 900)
266
+ provider.send(method, "foo", env: nil)
267
+ end
268
+ it "#{method} overrides the default timeout with its options and preserves options" do
269
+ expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil)
270
+ provider.send(method, "foo", timeout: 1, env: nil)
271
+ end
272
+ it "#{method} overrides the new_resource.timeout with the timeout option and preseves options" do
273
+ new_resource.timeout(99)
274
+ expect(provider).to receive(stubbed_method).with("foo", timeout: 1, env: nil)
275
+ provider.send(method, "foo", timeout: 1, env: nil)
278
276
  end
279
277
  end
280
278
  end
@@ -17,6 +17,7 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
+ require "spec_helper"
20
21
  require "support/shared/unit/provider/file"
21
22
 
22
23
  describe Chef::Provider::File do
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright 2018, Chef Software, Inc.
2
+ # Copyright:: Copyright 2018-2020, Chef Software, Inc.
3
3
  # License:: Apache License, Version 2.0
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,7 +19,23 @@ require "spec_helper"
19
19
 
20
20
  describe Chef::Resource::BuildEssential do
21
21
 
22
- let(:resource) { Chef::Resource::BuildEssential.new("foo") }
22
+ let(:node) { Chef::Node.new }
23
+ let(:events) { Chef::EventDispatch::Dispatcher.new }
24
+ let(:run_context) { Chef::RunContext.new(node, {}, events) }
25
+ let(:resource) { Chef::Resource::BuildEssential.new("foo", run_context) }
26
+ let(:provider) { resource.provider_for_action(:install) }
27
+
28
+ let(:softwareupdate_catalina_and_later) do
29
+ double("shell_out", exitstatus: 0, error!: nil, stdout: "Software Update Tool\n\nFinding available software\nSoftware Update found the following new or updated software:\n* Label: Command Line Tools for Xcode-11.0\n\tTitle: Command Line Tools for Xcode, Version: 11.0, Size: 224868K, Recommended: YES, \n")
30
+ end
31
+
32
+ let(:softwareupdate_catalina_and_later_no_cli) do
33
+ double("shell_out", exitstatus: 0, error!: nil, stdout: "Software Update Tool\n\nFinding available software\nSoftware Update found the following new or updated software:\n* Label: Chef Infra Client\n\tTitle: Chef Infra Client, Version: 17.0.208, Size: 224868K, Recommended: YES, \n")
34
+ end
35
+
36
+ let(:softwareupdate_pre_catalina) do
37
+ double("shell_out", exitstatus: 0, error!: nil, stdout: "Software Update Tool\n\nFinding available software\nSoftware Update found the following new or updated software:\n * Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0\n")
38
+ end
23
39
 
24
40
  it "has a resource name of :build_essential" do
25
41
  expect(resource.resource_name).to eql(:build_essential)
@@ -40,4 +56,34 @@ describe Chef::Resource::BuildEssential do
40
56
  expect(resource.name).to eql("")
41
57
  end
42
58
  end
59
+
60
+ describe "#xcode_cli_installed?" do
61
+ it "returns true if the CLI is in the InstallHistory plist" do
62
+ allow(::File).to receive(:open).with("/Library/Receipts/InstallHistory.plist", "r").and_return(::File.join(::File.dirname(__FILE__), "data/InstallHistory_with_CLT.plist"))
63
+ expect(provider.xcode_cli_installed?).to eql(true)
64
+ end
65
+
66
+ it "returns false if the pkgutil doesn't list the package" do
67
+ allow(::File).to receive(:open).with("/Library/Receipts/InstallHistory.plist", "r").and_return(::File.join(::File.dirname(__FILE__), "data/InstallHistory_without_CLT.plist"))
68
+ expect(provider.xcode_cli_installed?).to eql(false)
69
+ end
70
+ end
71
+
72
+ describe "#xcode_cli_package_label" do
73
+ it "returns a package name on macOS < 10.15" do
74
+ allow(provider).to receive(:shell_out).with("softwareupdate", "--list").and_return(softwareupdate_pre_catalina)
75
+ expect(provider.xcode_cli_package_label).to eql("Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0")
76
+ end
77
+
78
+ it "returns a package name on macOS 10.15+" do
79
+ allow(provider).to receive(:shell_out).with("softwareupdate", "--list").and_return(softwareupdate_catalina_and_later)
80
+ expect(provider.xcode_cli_package_label).to eql("Command Line Tools for Xcode-11.0")
81
+ end
82
+
83
+ it "returns nil if no update is listed" do
84
+ allow(provider).to receive(:shell_out).with("softwareupdate", "--list").and_return(softwareupdate_catalina_and_later_no_cli)
85
+ expect(provider.xcode_cli_package_label).to be_nil
86
+ end
87
+
88
+ end
43
89
  end
@@ -0,0 +1,92 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <array>
5
+ <dict>
6
+ <key>contentType</key>
7
+ <string>config-data</string>
8
+ <key>date</key>
9
+ <date>2019-10-07T20:09:37Z</date>
10
+ <key>displayName</key>
11
+ <string>XProtectPlistConfigData</string>
12
+ <key>displayVersion</key>
13
+ <string>2106</string>
14
+ <key>packageIdentifiers</key>
15
+ <array>
16
+ <string>com.apple.pkg.XProtectPlistConfigData_10_15.16U4081</string>
17
+ </array>
18
+ <key>processName</key>
19
+ <string>softwareupdated</string>
20
+ </dict>
21
+ <dict>
22
+ <key>contentType</key>
23
+ <string>config-data</string>
24
+ <key>date</key>
25
+ <date>2019-10-07T20:09:37Z</date>
26
+ <key>displayName</key>
27
+ <string>Gatekeeper Configuration Data</string>
28
+ <key>displayVersion</key>
29
+ <string>181</string>
30
+ <key>packageIdentifiers</key>
31
+ <array>
32
+ <string>com.apple.pkg.GatekeeperConfigData.16U1873</string>
33
+ </array>
34
+ <key>processName</key>
35
+ <string>softwareupdated</string>
36
+ </dict>
37
+ <dict>
38
+ <key>contentType</key>
39
+ <string>config-data</string>
40
+ <key>date</key>
41
+ <date>2019-10-07T20:09:37Z</date>
42
+ <key>displayName</key>
43
+ <string>MRTConfigData</string>
44
+ <key>displayVersion</key>
45
+ <string>1.50</string>
46
+ <key>packageIdentifiers</key>
47
+ <array>
48
+ <string>com.apple.pkg.MRTConfigData_10_15.16U4082</string>
49
+ </array>
50
+ <key>processName</key>
51
+ <string>softwareupdated</string>
52
+ </dict>
53
+ <dict>
54
+ <key>date</key>
55
+ <date>2019-10-09T02:37:33Z</date>
56
+ <key>displayName</key>
57
+ <string>Chef Infra Client</string>
58
+ <key>displayVersion</key>
59
+ <string></string>
60
+ <key>packageIdentifiers</key>
61
+ <array>
62
+ <string>com.getchef.pkg.chef</string>
63
+ </array>
64
+ <key>processName</key>
65
+ <string>installer</string>
66
+ </dict>
67
+ <dict>
68
+ <key>date</key>
69
+ <date>2019-10-09T02:47:02Z</date>
70
+ <key>displayName</key>
71
+ <string>Command Line Tools for Xcode</string>
72
+ <key>displayVersion</key>
73
+ <string>11.0</string>
74
+ <key>packageIdentifiers</key>
75
+ <array>
76
+ <string>com.apple.pkg.CLTools_Executables</string>
77
+ <string>com.apple.pkg.CLTools_SDK_macOS1015</string>
78
+ <string>com.apple.pkg.CLTools_SDK_macOS1014</string>
79
+ <string>com.apple.pkg.CLTools_macOS_SDK</string>
80
+ <string>com.apple.pkg.DevSDK</string>
81
+ <string>com.apple.pkg.DevSDK_OSX109</string>
82
+ <string>com.apple.pkg.DevSDK_OSX1010</string>
83
+ <string>com.apple.pkg.DevSDK_OSX1011</string>
84
+ <string>com.apple.pkg.DevSDK_OSX1012</string>
85
+ <string>com.apple.pkg.DevSDK_macOS1013_Public</string>
86
+ <string>com.apple.pkg.macOS_SDK_headers_for_macOS_10.14</string>
87
+ </array>
88
+ <key>processName</key>
89
+ <string>softwareupdated</string>
90
+ </dict>
91
+ </array>
92
+ </plist>
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <array>
5
+ <dict>
6
+ <key>contentType</key>
7
+ <string>config-data</string>
8
+ <key>date</key>
9
+ <date>2019-09-30T20:36:29Z</date>
10
+ <key>displayName</key>
11
+ <string>Gatekeeper Configuration Data</string>
12
+ <key>displayVersion</key>
13
+ <string>181</string>
14
+ <key>packageIdentifiers</key>
15
+ <array>
16
+ <string>com.apple.pkg.GatekeeperConfigData.16U1873</string>
17
+ </array>
18
+ <key>processName</key>
19
+ <string>softwareupdated</string>
20
+ </dict>
21
+ <dict>
22
+ <key>contentType</key>
23
+ <string>config-data</string>
24
+ <key>date</key>
25
+ <date>2019-09-30T20:36:29Z</date>
26
+ <key>displayName</key>
27
+ <string>MRTConfigData</string>
28
+ <key>displayVersion</key>
29
+ <string>1.49</string>
30
+ <key>packageIdentifiers</key>
31
+ <array>
32
+ <string>com.apple.pkg.MRTConfigData_10_15.16U4080</string>
33
+ </array>
34
+ <key>processName</key>
35
+ <string>softwareupdated</string>
36
+ </dict>
37
+ </array>
38
+ </plist>
@@ -109,7 +109,7 @@ describe Chef::Resource::Execute do
109
109
  shared_examples_for "a consumer of the Execute resource" do
110
110
  context "when running on Windows" do
111
111
  before do
112
- allow(resource).to receive(:node).and_return({ platform_family: "windows" })
112
+ allow(resource).to receive(:windows?).and_return(true)
113
113
  end
114
114
 
115
115
  context "when no user, domain, or password is specified" do
@@ -179,6 +179,30 @@ describe Chef::Resource::RhsmRegister do
179
179
  end
180
180
  end
181
181
 
182
+ describe "#ca_consumer_package_source" do
183
+ let(:satellite_host) { "sat-host" }
184
+
185
+ before do
186
+ resource.satellite_host = satellite_host
187
+ end
188
+
189
+ context "when https_for_ca_consumer is true" do
190
+ before { resource.https_for_ca_consumer true }
191
+
192
+ it "returns url with https" do
193
+ expect(provider.ca_consumer_package_source).to eq("https://#{satellite_host}/pub/katello-ca-consumer-latest.noarch.rpm")
194
+ end
195
+ end
196
+
197
+ context "when https_for_ca_consumer is false" do
198
+ before { resource.https_for_ca_consumer false }
199
+
200
+ it "returns url with http" do
201
+ expect(provider.ca_consumer_package_source).to eq("http://#{satellite_host}/pub/katello-ca-consumer-latest.noarch.rpm")
202
+ end
203
+ end
204
+ end
205
+
182
206
  describe "#registered_with_rhsm?" do
183
207
  let(:cmd) { double("cmd") }
184
208
 
@@ -38,9 +38,11 @@ describe Chef::Resource::WindowsShare do
38
38
  end
39
39
 
40
40
  it "coerces path to a single path separator format" do
41
- resource.path("C:/chef")
41
+ resource.path("C:/chef".freeze)
42
42
  expect(resource.path).to eql("C:\\chef")
43
43
  resource.path("C:\\chef")
44
44
  expect(resource.path).to eql("C:\\chef")
45
+ resource.path("C:/chef".dup)
46
+ expect(resource.path).to eql("C:\\chef")
45
47
  end
46
48
  end
@@ -82,6 +82,7 @@ begin
82
82
  %i{unit functional integration stress}.each do |sub|
83
83
  desc "Run the specs under spec/#{sub}"
84
84
  RSpec::Core::RakeTask.new(sub) do |t|
85
+ t.verbose = false
85
86
  t.rspec_opts = %w{--profile}
86
87
  t.pattern = FileList["spec/#{sub}/**/*_spec.rb"]
87
88
  end
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: 15.8.23
4
+ version: 15.9.17
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-02-07 00:00:00.000000000 Z
11
+ date: 2020-04-03 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: 15.8.23
19
+ version: 15.9.17
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: 15.8.23
26
+ version: 15.9.17
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: 15.8.23
33
+ version: 15.9.17
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: 15.8.23
40
+ version: 15.9.17
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -714,6 +714,7 @@ files:
714
714
  - distro/ruby_bin_folder/Newtonsoft.Json.dll
715
715
  - distro/ruby_bin_folder/msvcp140.dll
716
716
  - distro/ruby_bin_folder/vcruntime140.dll
717
+ - distro/templates/powershell/chef/chef.psm1.erb
717
718
  - ext/win32-eventlog/Rakefile
718
719
  - ext/win32-eventlog/chef-log.man.erb
719
720
  - lib/chef.rb
@@ -2623,6 +2624,8 @@ files:
2623
2624
  - spec/unit/resource/cron_d_spec.rb
2624
2625
  - spec/unit/resource/cron_spec.rb
2625
2626
  - spec/unit/resource/csh_spec.rb
2627
+ - spec/unit/resource/data/InstallHistory_with_CLT.plist
2628
+ - spec/unit/resource/data/InstallHistory_without_CLT.plist
2626
2629
  - spec/unit/resource/directory_spec.rb
2627
2630
  - spec/unit/resource/dmg_package_spec.rb
2628
2631
  - spec/unit/resource/dnf_package_spec.rb