chef 16.17.51 → 16.18.0

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: be2ce3e90bf16cdc6e45a5d38437ac5c09ddf28a932941d15e41cefb63799c5e
4
- data.tar.gz: 62836ee773fddcf98d3754f493140c32ed700f4a8579bfd6635999033993f544
3
+ metadata.gz: a65b4755816a9d5a1920b8f73627c07a6fadb7bc0d1f1132507ac3f547f289c8
4
+ data.tar.gz: 50671c4259fc3d44a1794ba13759bea7c317129615c027272b9905947cc238dd
5
5
  SHA512:
6
- metadata.gz: 1829789a8720ead98555f765b1d3888e48f34be72490bdd39dc7d98459a1bab97f17818f3163ff52915c03e0e079e391c8751bcabaf6988250fd8ffa29d02e1b
7
- data.tar.gz: d79cb28151cc22cfb1d924f88c655b058c5fa5a1e89bcb540816b80599415bb8e5346058a6da8cb35487bb32f74fd9f3f7d3a78f51fa2a78931e82ebb1ba700a
6
+ metadata.gz: eaaeb74c2d30b9bd21c8e777dc696730570a2901e60507feb65953324cff90cc4e7f1fb182f77a6bfdb02a238e05a709b872777fbe5aed062030fa5d9133a67d
7
+ data.tar.gz: 287087f0edecb64d7feeae4dddff412d26ec3579ad6e3eeaad33ab0a4b1e2d3d1b32eb9f31ac85f13e42e78e6c23f019e5f09dd34220ef92e90e31dd89d15817
data/lib/chef/client.rb CHANGED
@@ -327,12 +327,12 @@ class Chef
327
327
  def warn_if_eol
328
328
  require_relative "version"
329
329
 
330
- # We make a release every year so take the version you're on + 2006 and you get
330
+ # We make a release every year so take the version you're on + 2007 and you get
331
331
  # the year it goes EOL
332
332
  eol_year = 2006 + Gem::Version.new(Chef::VERSION).segments.first
333
333
 
334
- if Time.now > Time.new(eol_year, 5, 01)
335
- logger.warn("This release of #{ChefUtils::Dist::Infra::PRODUCT} became end of life (EOL) on May 1st #{eol_year}. Please update to a supported release to receive new features, bug fixes, and security updates.")
334
+ if Time.now > Time.new(eol_year, 11, 30)
335
+ logger.warn("This release of #{ChefUtils::Dist::Infra::PRODUCT} became end of life (EOL) on November 30th #{eol_year}. Please update to a supported release to receive new features, bug fixes, and security updates.")
336
336
  end
337
337
  end
338
338
 
@@ -450,17 +450,34 @@ class Chef
450
450
  # method-style access to attributes (has to come after the prepended ImmutablizeHash)
451
451
 
452
452
  def read(*path)
453
- merged_attributes.read(*path)
453
+ if path[0].nil?
454
+ Chef::Log.warn "Calling node.read() without any path argument is very slow, probably a bug, and should be avoided"
455
+ merged_attributes.read(*path) # re-merges everything, slow edge case
456
+ else
457
+ self[path[0]] unless path[0].nil? # force deep_merge_cache key construction if necessary
458
+ deep_merge_cache.read(*path)
459
+ end
454
460
  end
455
461
 
456
462
  alias :dig :read
457
463
 
458
464
  def read!(*path)
459
- merged_attributes.read!(*path)
465
+ if path[0].nil?
466
+ Chef::Log.warn "Calling node.read!() without any path argument is very slow, probably a bug, and should be avoided"
467
+ merged_attributes.read!(*path) # re-merges everything, slow edge case
468
+ else
469
+ self[path[0]] unless path[0].nil? # force deep_merge_cache key construction if necessary
470
+ deep_merge_cache.read!(*path)
471
+ end
460
472
  end
461
473
 
462
474
  def exist?(*path)
463
- merged_attributes.exist?(*path)
475
+ if path[0].nil?
476
+ true
477
+ else
478
+ self[path[0]] unless path[0].nil? # force deep_merge_cache key construction if necessary
479
+ deep_merge_cache.exist?(*path)
480
+ end
464
481
  end
465
482
 
466
483
  def write(level, *args, &block)
@@ -28,7 +28,7 @@ class Chef
28
28
  @merged_attributes = nil
29
29
  @combined_override = nil
30
30
  @combined_default = nil
31
- @deep_merge_cache = {}
31
+ @deep_merge_cache = Chef::Node::ImmutableMash.new
32
32
  end
33
33
 
34
34
  # Invalidate a key in the deep_merge_cache. If called with nil, or no arg, this will invalidate
@@ -37,9 +37,9 @@ class Chef
37
37
  # must invalidate the entire cache and re-deep-merge the entire node object.
38
38
  def reset_cache(path = nil)
39
39
  if path.nil?
40
- deep_merge_cache.clear
40
+ deep_merge_cache.regular_clear
41
41
  else
42
- deep_merge_cache.delete(path.to_s)
42
+ deep_merge_cache.regular_delete(path.to_s)
43
43
  end
44
44
  end
45
45
 
@@ -51,7 +51,7 @@ class Chef
51
51
  deep_merge_cache[key.to_s]
52
52
  else
53
53
  # save all the work of computing node[key]
54
- deep_merge_cache[key.to_s] = merged_attributes(key)
54
+ deep_merge_cache.internal_set(key.to_s, merged_attributes(key))
55
55
  end
56
56
  end
57
57
 
@@ -13,8 +13,6 @@
13
13
  @minimal_ohai
14
14
  @named_run_list
15
15
  @no_proxy
16
- @ohai_disabled_plugins
17
- @ohai_optional_plugins
18
16
  @pid_file
19
17
  @policy_group
20
18
  @policy_name
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.17.51")
26
+ VERSION = Chef::VersionString.new("16.18.0")
27
27
  end
28
28
 
29
29
  #
@@ -41,6 +41,10 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
41
41
  provider
42
42
  end
43
43
 
44
+ before(:all) do
45
+ ENV["Path"] = ENV.delete("Path")
46
+ end
47
+
44
48
  context "installing a package" do
45
49
  after { remove_package }
46
50
 
@@ -310,14 +310,14 @@ describe Chef::Client do
310
310
 
311
311
  describe "eol release warning" do
312
312
  it "warns when running an EOL release" do
313
- stub_const("Chef::VERSION", 15)
314
- allow(Time).to receive(:now).and_return(Time.new(2021, 5, 1, 5))
315
- expect(logger).to receive(:warn).with(/This release of.*became end of life \(EOL\) on May 1st 2021/)
313
+ stub_const("Chef::VERSION", 16)
314
+ allow(Time).to receive(:now).and_return(Time.new(2022, 11, 30, 5))
315
+ expect(logger).to receive(:warn).with("This release of #{ChefUtils::Dist::Infra::PRODUCT} became end of life (EOL) on November 30th 2022. Please update to a supported release to receive new features, bug fixes, and security updates.")
316
316
  client.warn_if_eol
317
317
  end
318
318
 
319
319
  it "does not warn when running an non-EOL release" do
320
- stub_const("Chef::VERSION", 15)
320
+ stub_const("Chef::VERSION", 16)
321
321
  allow(Time).to receive(:now).and_return(Time.new(2021, 4, 31))
322
322
  expect(logger).to_not receive(:warn).with(/became end of life/)
323
323
  client.warn_if_eol
@@ -30,7 +30,7 @@ describe Chef::Mixin::PowershellOut, :windows_only do
30
30
  it "runs a command and returns the shell_out object" do
31
31
  ret = double("Mixlib::ShellOut")
32
32
  expect(object).to receive(:shell_out).with(
33
- "powershell.exe #{flags} -Command \"Get-Process\""
33
+ "powershell.exe #{flags} -Command \"Get-Process\"", {}
34
34
  ).and_return(ret)
35
35
  expect(object.powershell_out("Get-Process")).to eql(ret)
36
36
  end
@@ -75,7 +75,7 @@ describe Chef::Mixin::PowershellOut, :windows_only do
75
75
  it "runs a command and returns the shell_out object" do
76
76
  mixlib_shellout = double("Mixlib::ShellOut")
77
77
  expect(object).to receive(:shell_out).with(
78
- "powershell.exe #{flags} -Command \"Get-Process\""
78
+ "powershell.exe #{flags} -Command \"Get-Process\"", {}
79
79
  ).and_return(mixlib_shellout)
80
80
  expect(mixlib_shellout).to receive(:error!)
81
81
  expect(object.powershell_out!("Get-Process")).to eql(mixlib_shellout)
@@ -931,14 +931,14 @@ describe Chef::Resource do
931
931
 
932
932
  it "adds mappings for all platforms", ruby: "< 2.7" do
933
933
  expect(Chef.resource_handler_map).to receive(:set).with(
934
- :tape_deck, Chef::Resource::Klz, {}
934
+ :tape_deck, Chef::Resource::Klz
935
935
  )
936
936
  klz.provides :tape_deck
937
937
  end
938
938
 
939
939
  it "adds mappings for all platforms", ruby: ">= 2.7" do
940
940
  expect(Chef.resource_handler_map).to receive(:set).with(
941
- :tape_deck, Chef::Resource::Klz
941
+ :tape_deck, Chef::Resource::Klz, {}
942
942
  )
943
943
  klz.provides :tape_deck
944
944
  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: 16.17.51
4
+ version: 16.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-16 00:00:00.000000000 Z
11
+ date: 2022-04-28 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.17.51
19
+ version: 16.18.0
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.17.51
26
+ version: 16.18.0
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.17.51
33
+ version: 16.18.0
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.17.51
40
+ version: 16.18.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement