chef 16.14.1-universal-mingw32 → 16.17.4-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/chef/action_collection.rb +1 -1
  3. data/lib/chef/application.rb +1 -1
  4. data/lib/chef/cookbook_version.rb +26 -4
  5. data/lib/chef/data_collector/run_end_message.rb +2 -2
  6. data/lib/chef/deprecated.rb +14 -4
  7. data/lib/chef/exceptions.rb +3 -0
  8. data/lib/chef/formatters/error_mapper.rb +2 -2
  9. data/lib/chef/http.rb +5 -5
  10. data/lib/chef/knife/bootstrap.rb +1 -1
  11. data/lib/chef/node.rb +20 -19
  12. data/lib/chef/policy_builder/policyfile.rb +5 -0
  13. data/lib/chef/provider/group/dscl.rb +1 -1
  14. data/lib/chef/provider/package/powershell.rb +5 -0
  15. data/lib/chef/provider/template/content.rb +1 -1
  16. data/lib/chef/resource/chef_client_trusted_certificate.rb +1 -0
  17. data/lib/chef/resource/homebrew_cask.rb +13 -7
  18. data/lib/chef/resource/mount.rb +1 -1
  19. data/lib/chef/resource/rhsm_subscription.rb +5 -5
  20. data/lib/chef/resource/support/client.erb +6 -0
  21. data/lib/chef/resource/systemd_unit.rb +1 -1
  22. data/lib/chef/resource/user_ulimit.rb +1 -0
  23. data/lib/chef/resource/windows_security_policy.rb +55 -39
  24. data/lib/chef/resource/windows_uac.rb +3 -1
  25. data/lib/chef/resource/windows_user_privilege.rb +1 -1
  26. data/lib/chef/resource.rb +1 -1
  27. data/lib/chef/resource_reporter.rb +1 -1
  28. data/lib/chef/shell/ext.rb +3 -3
  29. data/lib/chef/version.rb +1 -1
  30. data/lib/chef/win32/api.rb +9 -2
  31. data/lib/chef/win32/version.rb +2 -1
  32. data/spec/functional/resource/group_spec.rb +5 -1
  33. data/spec/functional/resource/link_spec.rb +8 -0
  34. data/spec/integration/knife/delete_spec.rb +1 -1
  35. data/spec/integration/knife/download_spec.rb +2 -2
  36. data/spec/integration/knife/upload_spec.rb +5 -6
  37. data/spec/unit/cookbook_version_spec.rb +52 -0
  38. data/spec/unit/data_collector_spec.rb +71 -2
  39. data/spec/unit/policy_builder/policyfile_spec.rb +11 -1
  40. data/spec/unit/provider/package/powershell_spec.rb +74 -12
  41. data/spec/unit/resource/chef_client_trusted_certificate_spec.rb +14 -0
  42. data/spec/unit/resource/homebrew_cask_spec.rb +29 -11
  43. data/spec/unit/resource/mount_spec.rb +10 -0
  44. data/spec/unit/resource/rhsm_subscription_spec.rb +50 -3
  45. data/spec/unit/resource/systemd_unit_spec.rb +1 -1
  46. data/spec/unit/resource/user_ulimit_spec.rb +14 -1
  47. data/spec/unit/resource_spec.rb +5 -0
  48. metadata +6 -6
@@ -18,15 +18,24 @@
18
18
  require "spec_helper"
19
19
 
20
20
  describe Chef::Resource::RhsmSubscription do
21
- let(:resource) { Chef::Resource::RhsmSubscription.new("fakey_fakerton") }
22
- let(:provider) { resource.provider_for_action(:attach) }
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("fakey_fakerton")
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 = 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" }
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
@@ -348,6 +348,11 @@ describe Chef::Resource do
348
348
  it "should recognize dynamically defined resources" do
349
349
  expect(resource.defined_at).to eq("dynamically defined")
350
350
  end
351
+
352
+ it "should return nil for the cookbook_version when the cookbook_name is @recipe_files" do
353
+ resource.cookbook_name = "@recipe_files"
354
+ expect(resource.cookbook_version).to be nil
355
+ end
351
356
  end
352
357
 
353
358
  describe "to_s" do
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.14.1
4
+ version: 16.17.4
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-07-27 00:00:00.000000000 Z
11
+ date: 2021-11-09 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.14.1
19
+ version: 16.17.4
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.14.1
26
+ version: 16.17.4
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.14.1
33
+ version: 16.17.4
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.14.1
40
+ version: 16.17.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement