chef 17.9.46-universal-mingw32 → 17.9.52-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/compliance/default_attributes.rb +1 -1
- data/lib/chef/compliance/reporter/compliance_enforcer.rb +1 -1
- data/lib/chef/compliance/runner.rb +2 -2
- data/lib/chef/resource.rb +1 -0
- data/lib/chef/version.rb +1 -1
- data/spec/unit/compliance/reporter/compliance_enforcer_spec.rb +3 -3
- data/spec/unit/resource_spec.rb +12 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef4f4acb5e1adc0f97c4eaf653095911e5206dfb761b740b710cbaf78358c0dc
|
4
|
+
data.tar.gz: 38ad6e54f2c3671b389ca4eafa897c3ccea722774aca326aaf65b3dbc8164e28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d48d9f5d33b520dd732ba953e0d1c3624412f34e00585085fbe6c81d4d19664a240d2d716b3362a2a310b1754a3a50c4378c83c43abe33af78c62afd045dcf90
|
7
|
+
data.tar.gz: 94d27dfbc0507da0f0cf9df56efc0f14039e33fd3c21d410667ed54f0438333fdac5655b789b9972afdcb57ae6bb14fbf5bb0e15dbd35111efce3dafe4215fb5
|
@@ -27,7 +27,7 @@ class Chef
|
|
27
27
|
|
28
28
|
# Controls what is done with the resulting report after the Chef InSpec run.
|
29
29
|
# Accepts a single string value or an array of multiple values.
|
30
|
-
# Accepted values: 'chef-server-automate', 'chef-automate', 'json-file', 'audit-enforcer', 'cli'
|
30
|
+
# Accepted values: 'chef-server-automate', 'chef-automate', 'json-file', 'audit-enforcer', 'compliance-enforcer', 'cli'
|
31
31
|
"reporter" => nil,
|
32
32
|
|
33
33
|
# Controls if Chef InSpec profiles should be fetched from Chef Automate or Chef Infra Server
|
@@ -7,7 +7,7 @@ class Chef
|
|
7
7
|
class Runner < EventDispatch::Base
|
8
8
|
extend Forwardable
|
9
9
|
|
10
|
-
SUPPORTED_REPORTERS = %w{chef-automate chef-server-automate json-file audit-enforcer cli}.freeze
|
10
|
+
SUPPORTED_REPORTERS = %w{chef-automate chef-server-automate json-file audit-enforcer compliance-enforcer cli}.freeze
|
11
11
|
SUPPORTED_FETCHERS = %w{chef-automate chef-server}.freeze
|
12
12
|
|
13
13
|
attr_accessor :run_id
|
@@ -300,7 +300,7 @@ class Chef
|
|
300
300
|
require_relative "reporter/json_file"
|
301
301
|
path = node.dig("audit", "json_file", "location")
|
302
302
|
Chef::Compliance::Reporter::JsonFile.new(file: path)
|
303
|
-
when "audit-enforcer"
|
303
|
+
when "audit-enforcer", "compliance-enforcer"
|
304
304
|
require_relative "reporter/compliance_enforcer"
|
305
305
|
Chef::Compliance::Reporter::ComplianceEnforcer.new
|
306
306
|
when "cli"
|
data/lib/chef/resource.rb
CHANGED
@@ -341,6 +341,7 @@ class Chef
|
|
341
341
|
def subscribes(action, resources, timing = :delayed)
|
342
342
|
resources = [resources].flatten
|
343
343
|
resources.each do |resource|
|
344
|
+
validate_resource_spec!(resource)
|
344
345
|
if resource.is_a?(String)
|
345
346
|
resource = UnresolvedSubscribes.new(resource, run_context)
|
346
347
|
end
|
data/lib/chef/version.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "chef/compliance/reporter/compliance_enforcer"
|
3
3
|
|
4
|
-
describe Chef::Compliance::Reporter::
|
5
|
-
let(:reporter) { Chef::Compliance::Reporter::
|
4
|
+
describe Chef::Compliance::Reporter::ComplianceEnforcer do
|
5
|
+
let(:reporter) { Chef::Compliance::Reporter::ComplianceEnforcer.new }
|
6
6
|
|
7
7
|
it "does not raise error for a successful InSpec report" do
|
8
8
|
report = {
|
@@ -44,6 +44,6 @@ describe Chef::Compliance::Reporter::AuditEnforcer do
|
|
44
44
|
|
45
45
|
expect {
|
46
46
|
reporter.send_report(report)
|
47
|
-
}.to raise_error(Chef::Compliance::Reporter::
|
47
|
+
}.to raise_error(Chef::Compliance::Reporter::ComplianceEnforcer::ControlFailure, "Audit c2 has failed. Aborting chef-client run.")
|
48
48
|
end
|
49
49
|
end
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -300,27 +300,35 @@ describe Chef::Resource do
|
|
300
300
|
end
|
301
301
|
|
302
302
|
describe "subscribes" do
|
303
|
+
context "with syntax error in resources parameter" do
|
304
|
+
it "raises an exception immediately" do
|
305
|
+
expect do
|
306
|
+
resource.subscribes(:run, "typo[missing-closing-bracket")
|
307
|
+
end.to raise_error(Chef::Exceptions::InvalidResourceSpecification)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
303
311
|
it "should make resources appear in the actions hash of subscribed nodes" do
|
304
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
|
312
|
+
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee", run_context)
|
305
313
|
zr = run_context.resource_collection.find(zen_master: "coffee")
|
306
314
|
resource.subscribes :reload, zr
|
307
315
|
expect(zr.delayed_notifications.detect { |e| e.resource.name == "funk" && e.action == :reload }).not_to be_nil
|
308
316
|
end
|
309
317
|
|
310
318
|
it "should make resources appear in the actions hash of subscribed nodes" do
|
311
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
|
319
|
+
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee", run_context)
|
312
320
|
zr = run_context.resource_collection.find(zen_master: "coffee")
|
313
321
|
resource.subscribes :reload, zr
|
314
322
|
expect(zr.delayed_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
|
315
323
|
|
316
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("bean")
|
324
|
+
run_context.resource_collection << Chef::Resource::ZenMaster.new("bean", run_context)
|
317
325
|
zrb = run_context.resource_collection.find(zen_master: "bean")
|
318
326
|
zrb.subscribes :reload, zr
|
319
327
|
expect(zr.delayed_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
|
320
328
|
end
|
321
329
|
|
322
330
|
it "should make subscribed resources be capable of acting immediately" do
|
323
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
|
331
|
+
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee", run_context)
|
324
332
|
zr = run_context.resource_collection.find(zen_master: "coffee")
|
325
333
|
resource.subscribes :reload, zr, :immediately
|
326
334
|
expect(zr.immediate_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
|
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: 17.9.
|
4
|
+
version: 17.9.52
|
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: 2022-02-
|
11
|
+
date: 2022-02-18 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: 17.9.
|
19
|
+
version: 17.9.52
|
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: 17.9.
|
26
|
+
version: 17.9.52
|
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: 17.9.
|
33
|
+
version: 17.9.52
|
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: 17.9.
|
40
|
+
version: 17.9.52
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|