chef 16.16.13 → 16.17.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/action_collection.rb +1 -1
- data/lib/chef/application.rb +1 -1
- data/lib/chef/data_collector/run_end_message.rb +1 -1
- data/lib/chef/resource/chef_client_trusted_certificate.rb +1 -0
- data/lib/chef/resource.rb +1 -1
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/version.rb +1 -1
- data/spec/integration/knife/delete_spec.rb +1 -1
- data/spec/integration/knife/download_spec.rb +2 -2
- data/spec/integration/knife/upload_spec.rb +5 -6
- data/spec/unit/data_collector_spec.rb +24 -1
- data/spec/unit/resource/chef_client_trusted_certificate_spec.rb +14 -0
- data/spec/unit/resource_spec.rb +5 -0
- 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: c600cebfc79b7b124f1017921af9c5044322ec47d8f06580bac479eb7aa908e2
|
4
|
+
data.tar.gz: 889d51f238676329b075bf34881a937d334bab0e920e9dc8bb3ea1b3693dbbc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84a4cf060f25d26486191be0010b1e9a8ec31ea180531ef94afe00a36038b36f0e26de96cba33da2f78f6fefb2ae83fc2fceaf2b91f495c895f92245f7d4620f
|
7
|
+
data.tar.gz: c6f757ad7b6db16c8ce3b344f00006324f52aa90821e64b4a6f6c078ba97b87a4a1eb16b41380a5910a14fe116637210dee73298f2e605e77c20cce84cd4b20d
|
@@ -128,7 +128,7 @@ class Chef
|
|
128
128
|
#
|
129
129
|
def cookbook_compilation_start(run_context)
|
130
130
|
run_context.action_collection = self
|
131
|
-
# fire the
|
131
|
+
# fire the action_collection_registration hook after cookbook_compilation_start -- last chance for consumers to register
|
132
132
|
run_context.events.enqueue(:action_collection_registration, self)
|
133
133
|
@run_context = run_context
|
134
134
|
end
|
data/lib/chef/application.rb
CHANGED
@@ -310,7 +310,7 @@ class Chef
|
|
310
310
|
logger.info "Forking #{ChefUtils::Dist::Infra::PRODUCT} instance to converge..."
|
311
311
|
pid = fork do
|
312
312
|
# Want to allow forked processes to finish converging when
|
313
|
-
# TERM
|
313
|
+
# TERM signal is received (exit gracefully)
|
314
314
|
trap("TERM") do
|
315
315
|
logger.debug("SIGTERM received during converge," +
|
316
316
|
" finishing converge to exit normally (send SIGINT to terminate immediately)")
|
@@ -128,7 +128,7 @@ class Chef
|
|
128
128
|
|
129
129
|
if new_resource.cookbook_name
|
130
130
|
hash["cookbook_name"] = new_resource.cookbook_name
|
131
|
-
hash["cookbook_version"] = new_resource.cookbook_version
|
131
|
+
hash["cookbook_version"] = new_resource.cookbook_version&.version
|
132
132
|
hash["recipe_name"] = new_resource.recipe_name
|
133
133
|
end
|
134
134
|
|
data/lib/chef/resource.rb
CHANGED
@@ -1513,7 +1513,7 @@ class Chef
|
|
1513
1513
|
# @return Chef::CookbookVersion The cookbook in which this Resource was defined.
|
1514
1514
|
#
|
1515
1515
|
def cookbook_version
|
1516
|
-
if cookbook_name
|
1516
|
+
if cookbook_name && cookbook_name != "@recipe_files"
|
1517
1517
|
run_context.cookbook_collection[cookbook_name]
|
1518
1518
|
end
|
1519
1519
|
end
|
@@ -41,7 +41,7 @@ class Chef
|
|
41
41
|
as_hash["result"] = action_record.action.to_s
|
42
42
|
if new_resource.cookbook_name
|
43
43
|
as_hash["cookbook_name"] = new_resource.cookbook_name
|
44
|
-
as_hash["cookbook_version"] = new_resource.cookbook_version
|
44
|
+
as_hash["cookbook_version"] = new_resource.cookbook_version&.version
|
45
45
|
end
|
46
46
|
|
47
47
|
as_hash
|
data/lib/chef/shell/ext.rb
CHANGED
@@ -198,9 +198,9 @@ module Shell
|
|
198
198
|
prints a detailed explanation of the command if available, or the
|
199
199
|
description if no explanation is available.
|
200
200
|
E
|
201
|
-
def help(
|
202
|
-
if
|
203
|
-
explain_command(
|
201
|
+
def help(command = nil)
|
202
|
+
if command
|
203
|
+
explain_command(command)
|
204
204
|
else
|
205
205
|
puts help_banner
|
206
206
|
end
|
data/lib/chef/version.rb
CHANGED
@@ -992,7 +992,7 @@ describe "knife delete", :workstation do
|
|
992
992
|
end
|
993
993
|
|
994
994
|
it "knife delete /policies/x-1.2.3.json succeeds" do
|
995
|
-
knife("raw /policies/x/revisions/1.2.3").should_succeed "{\n \"name\": \"x\",\n \"revision_id\": \"1.2.3\",\n \"run_list\": [\n\n ],\n \"cookbook_locks\": {\n\n }\n}\n"
|
995
|
+
knife("raw /policies/x/revisions/1.2.3").should_succeed "{\n \"policy_group_list\": [\n \"x\"\n ],\n \"name\": \"x\",\n \"revision_id\": \"1.2.3\",\n \"run_list\": [\n\n ],\n \"cookbook_locks\": {\n\n }\n}\n"
|
996
996
|
knife("delete /policies/x-1.2.3.json").should_succeed "Deleted /policies/x-1.2.3.json\n"
|
997
997
|
knife("raw /policies/x/revisions/1.2.3").should_fail(/404/)
|
998
998
|
end
|
@@ -1276,8 +1276,8 @@ describe "knife download", :workstation do
|
|
1276
1276
|
file "members.json", [ "bar" ]
|
1277
1277
|
file "nodes/x.json", { "normal" => { "tags" => [] } }
|
1278
1278
|
file "org.json", { "full_name" => "Something" }
|
1279
|
-
file "policies/x-1.0.0.json", {}
|
1280
|
-
file "policies/blah-1.0.0.json", {}
|
1279
|
+
file "policies/x-1.0.0.json", { "policy_group_list" => [ "x" ] }
|
1280
|
+
file "policies/blah-1.0.0.json", { "policy_group_list" => [ "x" ] }
|
1281
1281
|
file "policy_groups/x.json", { "policies" => { "x" => { "revision_id" => "1.0.0" }, "blah" => { "revision_id" => "1.0.0" } } }
|
1282
1282
|
file "roles/x.json", {}
|
1283
1283
|
end
|
@@ -1383,8 +1383,8 @@ describe "knife upload", :workstation do
|
|
1383
1383
|
file "members.json", [ "bar" ]
|
1384
1384
|
file "org.json", { "full_name" => "wootles" }
|
1385
1385
|
file "nodes/x.json", { "normal" => { "tags" => [] } }
|
1386
|
-
file "policies/x-1.0.0.json", {}
|
1387
|
-
file "policies/blah-1.0.0.json", {}
|
1386
|
+
file "policies/x-1.0.0.json", { "policy_group_list" => [ "x" ] }
|
1387
|
+
file "policies/blah-1.0.0.json", { "policy_group_list" => [ "x" ] }
|
1388
1388
|
file "policy_groups/x.json", { "policies" => { "x" => { "revision_id" => "1.0.0" }, "blah" => { "revision_id" => "1.0.0" } } }
|
1389
1389
|
file "roles/x.json", {}
|
1390
1390
|
end
|
@@ -1484,12 +1484,11 @@ describe "knife upload", :workstation do
|
|
1484
1484
|
environment "x", { "description" => "foo" }
|
1485
1485
|
group "x", { "groups" => [ "admin" ] }
|
1486
1486
|
node "x", { "run_list" => [ "blah" ] }
|
1487
|
-
policy "x", "1.0.0", {}
|
1488
|
-
policy "
|
1489
|
-
policy "y", "1.0.0", {}
|
1487
|
+
policy "x", "1.0.0", { "policy_group_list" => [ "x" ] }
|
1488
|
+
policy "y", "1.0.0", { "policy_group_list" => [ "x" ] }
|
1490
1489
|
policy_group "x", {
|
1491
1490
|
"policies" => {
|
1492
|
-
"x" => { "revision_id" => "1.0.
|
1491
|
+
"x" => { "revision_id" => "1.0.0" },
|
1493
1492
|
"y" => { "revision_id" => "1.0.0" },
|
1494
1493
|
},
|
1495
1494
|
}
|
@@ -164,7 +164,7 @@ describe Chef::DataCollector do
|
|
164
164
|
"after" => after_resource&.state_for_resource_reporter || {},
|
165
165
|
"before" => before_resource&.state_for_resource_reporter || {},
|
166
166
|
"cookbook_name" => cookbook_name,
|
167
|
-
"cookbook_version" => cookbook_version
|
167
|
+
"cookbook_version" => cookbook_version&.version,
|
168
168
|
"delta" => resource_has_diff(new_resource, status) ? new_resource.diff : "",
|
169
169
|
"duration" => duration,
|
170
170
|
"id" => new_resource.identity,
|
@@ -567,6 +567,29 @@ describe Chef::DataCollector do
|
|
567
567
|
it_behaves_like "sends a converge message"
|
568
568
|
end
|
569
569
|
|
570
|
+
context "when the run contains a file resource that is up-to-date from a @recipe_files, returns nil for the version" do
|
571
|
+
let(:total_resource_count) { 1 }
|
572
|
+
let(:updated_resource_count) { 0 }
|
573
|
+
let(:cookbook_name) { "@recipe_files" }
|
574
|
+
let(:resource_record) { [ resource_record_for(new_resource, current_resource, after_resource, :create, "up-to-date", "1234") ] }
|
575
|
+
let(:status) { "success" }
|
576
|
+
let(:cookbook_version) { nil }
|
577
|
+
|
578
|
+
before do
|
579
|
+
allow(new_resource).to receive(:cookbook_version).and_call_original
|
580
|
+
events.resource_action_start(new_resource, :create)
|
581
|
+
events.resource_current_state_loaded(new_resource, :create, current_resource)
|
582
|
+
events.resource_up_to_date(new_resource, :create)
|
583
|
+
events.resource_after_state_loaded(new_resource, :create, after_resource)
|
584
|
+
new_resource.instance_variable_set(:@elapsed_time, 1.2345)
|
585
|
+
events.resource_completed(new_resource)
|
586
|
+
events.converge_complete
|
587
|
+
run_status.stop_clock
|
588
|
+
end
|
589
|
+
|
590
|
+
it_behaves_like "sends a converge message"
|
591
|
+
end
|
592
|
+
|
570
593
|
context "when the run contains a file resource that is updated" do
|
571
594
|
let(:total_resource_count) { 1 }
|
572
595
|
let(:updated_resource_count) { 1 }
|
@@ -51,4 +51,18 @@ describe Chef::Resource::ChefClientTrustedCertificate do
|
|
51
51
|
expect(provider.cert_path).to match(%r{trusted_certs/something.pem$})
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
describe "sensitive attribute" do
|
56
|
+
context "should be insensitive by default" do
|
57
|
+
it { expect(resource.sensitive).to(be_falsey) }
|
58
|
+
end
|
59
|
+
|
60
|
+
context "when set" do
|
61
|
+
before { resource.sensitive(true) }
|
62
|
+
|
63
|
+
it "should be set on the resource" do
|
64
|
+
expect(resource.sensitive).to(be_truthy)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
54
68
|
end
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -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.
|
4
|
+
version: 16.17.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
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.
|
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.
|
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.
|
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.
|
40
|
+
version: 16.17.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|