chef 15.12.22 → 15.13.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -4
  3. data/chef-universal-mingw32.gemspec +2 -2
  4. data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -0
  5. data/lib/chef/deprecated.rb +4 -0
  6. data/lib/chef/exceptions.rb +3 -0
  7. data/lib/chef/knife/bootstrap.rb +1 -1
  8. data/lib/chef/knife/bootstrap/train_connector.rb +1 -0
  9. data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
  10. data/lib/chef/knife/core/hashed_command_loader.rb +1 -0
  11. data/lib/chef/knife/core/subcommand_loader.rb +1 -1
  12. data/lib/chef/knife/ssh.rb +4 -0
  13. data/lib/chef/log.rb +1 -1
  14. data/lib/chef/mixin/openssl_helper.rb +26 -3
  15. data/lib/chef/mixin/template.rb +1 -0
  16. data/lib/chef/node_map.rb +5 -2
  17. data/lib/chef/provider/mount/solaris.rb +0 -1
  18. data/lib/chef/provider/package/zypper.rb +0 -1
  19. data/lib/chef/provider/yum_repository.rb +1 -1
  20. data/lib/chef/provider/zypper_repository.rb +1 -1
  21. data/lib/chef/resource.rb +2 -0
  22. data/lib/chef/resource/cron_access.rb +2 -2
  23. data/lib/chef/resource/cron_d.rb +1 -1
  24. data/lib/chef/resource/lwrp_base.rb +7 -0
  25. data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
  26. data/lib/chef/resource/sudo.rb +1 -1
  27. data/lib/chef/shell/shell_session.rb +2 -0
  28. data/lib/chef/version.rb +2 -2
  29. data/spec/functional/knife/ssh_spec.rb +4 -4
  30. data/spec/functional/resource/aix_service_spec.rb +0 -1
  31. data/spec/functional/resource/aixinit_service_spec.rb +0 -1
  32. data/spec/functional/resource/apt_package_spec.rb +0 -1
  33. data/spec/functional/resource/cron_spec.rb +0 -1
  34. data/spec/functional/resource/insserv_spec.rb +0 -1
  35. data/spec/functional/run_lock_spec.rb +2 -1
  36. data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
  37. data/spec/functional/version_spec.rb +1 -1
  38. data/spec/integration/recipes/accumulator_spec.rb +1 -1
  39. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
  40. data/spec/integration/recipes/lwrp_spec.rb +1 -1
  41. data/spec/integration/recipes/notifies_spec.rb +1 -1
  42. data/spec/integration/recipes/notifying_block_spec.rb +1 -1
  43. data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
  44. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +2 -0
  45. data/spec/integration/recipes/resource_load_spec.rb +1 -0
  46. data/spec/integration/recipes/unified_mode_spec.rb +1 -1
  47. data/spec/scripts/ssl-serve.rb +1 -1
  48. data/spec/spec_helper.rb +5 -4
  49. data/spec/support/shared/integration/knife_support.rb +2 -5
  50. data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +2 -4
  51. data/spec/unit/cookbook/gem_installer_spec.rb +2 -1
  52. data/spec/unit/dsl/platform_introspection_spec.rb +1 -0
  53. data/spec/unit/event_dispatch/dispatcher_spec.rb +3 -0
  54. data/spec/unit/knife/cookbook_upload_spec.rb +5 -6
  55. data/spec/unit/lwrp_spec.rb +4 -4
  56. data/spec/unit/mixin/securable_spec.rb +0 -1
  57. data/spec/unit/property_spec.rb +5 -5
  58. data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -1
  59. data/spec/unit/provider/package/rubygems_spec.rb +5 -10
  60. data/spec/unit/provider/package/windows_spec.rb +30 -53
  61. data/spec/unit/provider/service/windows_spec.rb +2 -6
  62. data/spec/unit/provider/systemd_unit_spec.rb +28 -24
  63. data/spec/unit/provider_spec.rb +1 -0
  64. data/spec/unit/resource/windows_package_spec.rb +1 -0
  65. data/spec/unit/run_context/cookbook_compiler_spec.rb +1 -1
  66. data/spec/unit/win32/security_spec.rb +4 -3
  67. metadata +6 -6
@@ -22,12 +22,8 @@ require "spec_helper"
22
22
  describe Chef::Provider::Service::Windows, "load_current_resource" do
23
23
  include_context "Win32"
24
24
 
25
- before(:all) do
26
- Chef::ReservedNames::Win32::Security = Class.new unless windows?
27
- end
28
-
29
- after(:all) do
30
- Chef::ReservedNames::Win32.send(:remove_const, :Security) unless windows?
25
+ before do
26
+ stub_const("Chef::ReservedNames::Win32::Security", Class.new) unless windows?
31
27
  end
32
28
 
33
29
  let(:logger) { double("Mixlib::Log::Child").as_null_object }
@@ -220,31 +220,35 @@ describe Chef::Provider::SystemdUnit do
220
220
  expect(current_resource.content).to eq(nil)
221
221
  end
222
222
 
223
- it "loads the user unit content if the file exists and user is set" do
224
- new_resource.user("joe")
225
- allow(File).to receive(:exist?)
226
- .with(unit_path_user)
227
- .and_return(true)
228
- allow(File).to receive(:read)
229
- .with(unit_path_user)
230
- .and_return(unit_content_string)
231
- expect(File).to receive(:exist?)
232
- .with(unit_path_user)
233
- expect(File).to receive(:read)
234
- .with(unit_path_user)
235
- provider.load_current_resource
236
- expect(current_resource.content).to eq(unit_content_string)
237
- end
223
+ # A password is required when specifying a user on Windows. Since systemd resources
224
+ # won't actually run on Windows, skip these tests rather than code a workaround.
225
+ unless windows?
226
+ it "loads the user unit content if the file exists and user is set" do
227
+ new_resource.user("joe")
228
+ allow(File).to receive(:exist?)
229
+ .with(unit_path_user)
230
+ .and_return(true)
231
+ allow(File).to receive(:read)
232
+ .with(unit_path_user)
233
+ .and_return(unit_content_string)
234
+ expect(File).to receive(:exist?)
235
+ .with(unit_path_user)
236
+ expect(File).to receive(:read)
237
+ .with(unit_path_user)
238
+ provider.load_current_resource
239
+ expect(current_resource.content).to eq(unit_content_string)
240
+ end
238
241
 
239
- it "does not load the user unit if the file does not exist and user is set" do
240
- new_resource.user("joe")
241
- allow(File).to receive(:exist?)
242
- .with(unit_path_user)
243
- .and_return(false)
244
- expect(File).to_not receive(:read)
245
- .with(unit_path_user)
246
- provider.load_current_resource
247
- expect(current_resource.content).to eq(nil)
242
+ it "does not load the user unit if the file does not exist and user is set" do
243
+ new_resource.user("joe")
244
+ allow(File).to receive(:exist?)
245
+ .with(unit_path_user)
246
+ .and_return(false)
247
+ expect(File).to_not receive(:read)
248
+ .with(unit_path_user)
249
+ provider.load_current_resource
250
+ expect(current_resource.content).to eq(nil)
251
+ end
248
252
  end
249
253
  end
250
254
 
@@ -20,6 +20,7 @@ require "spec_helper"
20
20
 
21
21
  class NoWhyrunDemonstrator < Chef::Provider
22
22
  attr_reader :system_state_altered
23
+
23
24
  def whyrun_supported?
24
25
  false
25
26
  end
@@ -58,6 +58,7 @@ describe Chef::Resource::WindowsPackage, "initialize" do
58
58
  expect { resource.installer_type :msi }.not_to raise_error
59
59
  expect { resource.installer_type :nsis }.not_to raise_error
60
60
  expect { resource.installer_type :wise }.not_to raise_error
61
+ expect { resource.installer_type :something_else_entirely }.to raise_error(Chef::Exceptions::ValidationFailed)
61
62
  expect { resource.installer_type "msi" }.to raise_error(Chef::Exceptions::ValidationFailed)
62
63
  end
63
64
 
@@ -175,7 +175,7 @@ describe Chef::RunContext::CookbookCompiler do
175
175
  describe "event dispatch" do
176
176
  let(:recipe) { "dependency1::default" }
177
177
  let(:recipe_path) do
178
- File.expand_path("../../../data/run_context/cookbooks/dependency1/recipes/default.rb", __FILE__)
178
+ File.expand_path("../../data/run_context/cookbooks/dependency1/recipes/default.rb", __dir__)
179
179
  end
180
180
  before do
181
181
  node.run_list(recipe)
@@ -81,9 +81,10 @@ describe "Chef::Win32::Security", :windows_only do
81
81
 
82
82
  context "when the user has admin privileges" do
83
83
  it "returns true" do
84
- allow(Chef::ReservedNames::Win32::Security).to receive(:open_current_process_token)
85
- token = Chef::ReservedNames::Win32::Security.open_current_process_token
84
+ token = double(:process_token)
86
85
  allow(token).to receive_message_chain(:handle, :handle)
86
+
87
+ allow(Chef::ReservedNames::Win32::Security).to receive(:open_current_process_token).and_return(token)
87
88
  allow(Chef::ReservedNames::Win32::Security).to receive(:get_token_information_elevation_type)
88
89
  allow(Chef::ReservedNames::Win32::Security).to receive(:GetTokenInformation).and_return(true)
89
90
  allow_any_instance_of(FFI::Buffer).to receive(:read_ulong).and_return(1)
@@ -128,7 +129,7 @@ describe "Chef::Win32::Security", :windows_only do
128
129
  context "when FFI::LastError.error result is not ERROR_INSUFFICIENT_BUFFER and not NO_ERROR" do
129
130
  it "raises Chef::ReservedNames::Win32::Error.raise! exception" do
130
131
  expect(FFI::LastError).to receive(:error).and_return(123).at_least(:once)
131
- expect { security_class.lookup_account_name "system" }.to raise_error
132
+ expect { security_class.lookup_account_name "system" }.to raise_error(Chef::Exceptions::Win32APIError)
132
133
  end
133
134
  end
134
135
  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.12.22
4
+ version: 15.13.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-26 00:00:00.000000000 Z
11
+ date: 2020-07-29 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.12.22
19
+ version: 15.13.8
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.12.22
26
+ version: 15.13.8
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.12.22
33
+ version: 15.13.8
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.12.22
40
+ version: 15.13.8
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement