chef 16.15.22 → 16.17.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a4e36c5d41c9a10ddd1c3ba836ba3a897b3808bb78f6d354be83ec14babd687
4
- data.tar.gz: 35c05384479bbdb4a4e122207d82fb805fc15e19526567e04f049f909b359d45
3
+ metadata.gz: b35f92ae31e3a9836b1da2d7457478c3d41888efc9bbe933e955dccfcdb5283c
4
+ data.tar.gz: 4041c0fb7065f9814cdb0569c75370361d0b91e5345c2cf3d1de889154e210fa
5
5
  SHA512:
6
- metadata.gz: cae2c4ce1e95cd8271eff16cd91947ee2bfce33413049f4e7db513ce3d837c741d96eec891460ff14e7f4d7183c70022ca4c541c84af60a0a6b63bfa9fa90657
7
- data.tar.gz: e003bd87fa50c8082234346bb697764769e13c71861390d10a91d67b558d99cb97b254ca3af22acc5a395641c7ad9f6111846a136f6f5fd0e2ff326084266bca
6
+ metadata.gz: 1ae55bb4680ad17f137512665abdb1ef9be42c37b85b17ac4c0c4e44160833651cdb31cc6b20b0d466c918010a0961e5168486e0a8a294f891e2c945c233c497
7
+ data.tar.gz: 0e3862296079442aea3fdae42576fe54cf3a262cb7cfd095cdb08d6ea9114e14152ecabc20762aaf41b2514be468bf4f5cc836543d4720ee3cc8602b833dd1ed
@@ -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 action_colleciton_registration hook after cookbook_compilation_start -- last chance for consumers to register
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
@@ -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 singal is received (exit gracefully)
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.version
131
+ hash["cookbook_version"] = new_resource.cookbook_version&.version
132
132
  hash["recipe_name"] = new_resource.recipe_name
133
133
  end
134
134
 
@@ -473,7 +473,7 @@ class Chef
473
473
  end
474
474
 
475
475
  # The server_name is the DNS or IP we are going to connect to, it is not necessarily
476
- # the node name, the fqdn, or the hostname of the server. This is a public API hook
476
+ # the node name, the fqdn, or the hostname of the server. This is a public API hook
477
477
  # which knife plugins use or inherit and override.
478
478
  #
479
479
  # @return [String] The DNS or IP that bootstrap will connect to
@@ -75,6 +75,7 @@ class Chef
75
75
  file cert_path do
76
76
  content new_resource.certificate
77
77
  mode "0640"
78
+ sensitive new_resource.sensitive
78
79
  end
79
80
  end
80
81
 
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.version
44
+ as_hash["cookbook_version"] = new_resource.cookbook_version&.version
45
45
  end
46
46
 
47
47
  as_hash
@@ -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(commmand = nil)
202
- if commmand
203
- explain_command(commmand)
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
@@ -23,7 +23,7 @@ require_relative "version_string"
23
23
 
24
24
  class Chef
25
25
  CHEF_ROOT = File.expand_path("..", __dir__)
26
- VERSION = Chef::VersionString.new("16.15.22")
26
+ VERSION = Chef::VersionString.new("16.17.18")
27
27
  end
28
28
 
29
29
  #
@@ -49,7 +49,8 @@ class Chef
49
49
  private_class_method :method_name_from_marketing_name
50
50
 
51
51
  WIN_VERSIONS = {
52
- "Windows Server 2019" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION && build_number >= 17763 } },
52
+ "Windows Server 2022" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION && build_number >= 20348 } },
53
+ "Windows Server 2019" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION && build_number >= 17763 && build_number < 20348 } },
53
54
  "Windows 10" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type == VER_NT_WORKSTATION } },
54
55
  "Windows Server 2016" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION && build_number <= 14393 } },
55
56
  "Windows 8.1" => { major: 6, minor: 3, callable: lambda { |product_type, suite_mask, build_number| product_type == VER_NT_WORKSTATION } },
@@ -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 "x", "1.0.1", {}
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.1" },
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.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
@@ -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.15.22
4
+ version: 16.17.18
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-09-20 00:00:00.000000000 Z
11
+ date: 2021-12-01 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.15.22
19
+ version: 16.17.18
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.15.22
26
+ version: 16.17.18
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.15.22
33
+ version: 16.17.18
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.15.22
40
+ version: 16.17.18
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement