chef-config 19.1.164 → 19.2.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 309b22099435d14e4f8be71a98aff1005772ac64dbf60c440e5d33f4fce10d53
4
- data.tar.gz: 8c46f82f7c17fdb2330ca0f2182f9e9476b3d7f96c18b13728d8749d1b86831a
3
+ metadata.gz: ca5fb5fc3d18ac20b341fe25bcf9e8af0a1a90ae0cfd770ceb48a37a781f6dde
4
+ data.tar.gz: ae0031d5fa88a0043a7a3aa4d1a5a6f3c91d567c0b33be4a4a94dcefccafb5bd
5
5
  SHA512:
6
- metadata.gz: c822ebbe0118452e6240c8d1c0818f90a13701694fa3d93fd700d123ce8150130ab911d076409c76989928678c0d3e04326c367499fc3bbea6902239833d8521
7
- data.tar.gz: 968e6d6a478e2ec8ef34fe3651fb9c7badc6c1b6a5bf59c832a916ee3d48a398104fe6f64c47f275d082c72c609158b3bfdda802f1ced9de4bc1c3de9f9ffab5
6
+ metadata.gz: 20b103258efcd8180aec43c7d8a61bd777b7a38434655b135d137d517d9d862f18fa494bb6cabf01d554762341d07688a26ad955e905ea32437d2018e5824363
7
+ data.tar.gz: 4c4e0fed39c55cc995403b101df099257b45523988a1278f1320ffb78f247338aa0bf6dd71fedf513cddcfe41f90b276e2795e9e00c851a41e4148b5430a84cd
data/chef-config.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "mixlib-config", ">= 2.2.12", "< 4.0"
30
30
  spec.add_dependency "fuzzyurl"
31
31
  spec.add_dependency "addressable"
32
- spec.add_dependency "tomlrb", "~> 1.2"
32
+ spec.add_dependency "tomlrb", ">= 1.2", "< 3.0"
33
33
  spec.add_dependency "racc"
34
34
 
35
35
  spec.files = %w{Rakefile LICENSE} + Dir.glob("*.gemspec") +
@@ -484,6 +484,14 @@ module ChefConfig
484
484
  # toggle info level log items that can create a lot of output
485
485
  default :verbose_logging, true
486
486
  default :node_name, nil
487
+
488
+ # When target mode is active, these hold the operator's original Chef Server
489
+ # identity so that API auth uses the admin credentials rather than the
490
+ # target node name. Set in Chef::Application::Client#reconfigure before
491
+ # target_mode.enabled is flipped to true.
492
+ default :api_client_name, nil
493
+ default :api_client_key, nil
494
+
487
495
  default :diff_disabled, false
488
496
  default :diff_filesize_threshold, 10000000
489
497
  default :diff_output_threshold, 1000000
@@ -1306,7 +1314,9 @@ module ChefConfig
1306
1314
  # sure Chef runs do not crash.
1307
1315
  # @api private
1308
1316
  def self.enable_fips_mode
1317
+ # Enable FIPS mode in OpenSSL.
1309
1318
  OpenSSL.fips_mode = true
1319
+
1310
1320
  require "digest" unless defined?(Digest)
1311
1321
  require "digest/sha1" unless defined?(Digest::SHA1)
1312
1322
  require "digest/md5" unless defined?(Digest::MD5)
@@ -1314,8 +1324,6 @@ module ChefConfig
1314
1324
  # amount of log spam and warnings.
1315
1325
  Digest.send(:remove_const, "SHA1") if Digest.const_defined?(:SHA1)
1316
1326
  Digest.const_set(:SHA1, OpenSSL::Digest::SHA1)
1317
- OpenSSL::Digest.send(:remove_const, "MD5") if OpenSSL::Digest.const_defined?(:MD5)
1318
- OpenSSL::Digest.const_set(:MD5, Digest::MD5)
1319
1327
  ChefConfig.logger.debug "FIPS mode is enabled."
1320
1328
  end
1321
1329
  end
@@ -42,6 +42,11 @@ module ChefConfig
42
42
  # Do greedy matching by adding wildcard if it is not specified
43
43
  match = "*" + match unless match.start_with?("*")
44
44
  Fuzzyurl.matches?(Fuzzyurl.mask(hostname: match), hostname)
45
+ rescue ArgumentError
46
+ # Fuzzyurl cannot parse certain URL formats, notably IPv6 addresses
47
+ # (bare, bracketed, or embedded in URLs). When parsing fails, the URL
48
+ # cannot match a no_proxy pattern, so return false.
49
+ false
45
50
  end
46
51
 
47
52
  end
@@ -15,5 +15,5 @@
15
15
 
16
16
  module ChefConfig
17
17
  CHEFCONFIG_ROOT = File.expand_path("..", __dir__)
18
- VERSION = "19.1.164".freeze
18
+ VERSION = "19.2.98".freeze
19
19
  end
@@ -26,6 +26,9 @@ RSpec.describe ChefConfig::Config do
26
26
 
27
27
  before(:each) do
28
28
  ChefConfig::Config.reset
29
+ ChefConfig::Config.instance_variable_set(:@var_chef_dir, nil)
30
+ ChefConfig::Config.instance_variable_set(:@etc_chef_dir, nil)
31
+ ChefConfig::Config.instance_variable_set(:@var_root_dir, nil)
29
32
 
30
33
  # By default, treat deprecation warnings as errors in tests.
31
34
  ChefConfig::Config.treat_deprecation_warnings_as_errors(true)
@@ -245,16 +248,18 @@ RSpec.describe ChefConfig::Config do
245
248
  end
246
249
 
247
250
  context "on windows", :windows_only do
248
- it "var_chef_dir is C:\\chef" do
249
- expect(ChefConfig::Config.var_chef_dir).to eql("C:\\#{dirname}")
251
+ let(:windows_drive) { ChefConfig::Config.windows_installation_drive || "C:" }
252
+
253
+ it "var_chef_dir is on the windows installation drive" do
254
+ expect(ChefConfig::Config.var_chef_dir).to eql("#{windows_drive}\\#{dirname}")
250
255
  end
251
256
 
252
257
  it "var_root_dir is C:\\" do
253
258
  expect(ChefConfig::Config.var_root_dir).to eql("C:\\")
254
259
  end
255
260
 
256
- it "etc_chef_dir is C:\\chef" do
257
- expect(ChefConfig::Config.etc_chef_dir).to eql("C:\\#{dirname}")
261
+ it "etc_chef_dir is on the windows installation drive" do
262
+ expect(ChefConfig::Config.etc_chef_dir).to eql("#{windows_drive}\\#{dirname}")
258
263
  end
259
264
  end
260
265
 
@@ -273,16 +278,18 @@ RSpec.describe ChefConfig::Config do
273
278
  end
274
279
 
275
280
  context "when forced to windows" do
276
- it "var_chef_dir is C:\\chef" do
277
- expect(ChefConfig::Config.var_chef_dir(windows: true)).to eql("C:\\#{dirname}")
281
+ let(:windows_drive) { ChefConfig::Config.windows_installation_drive || "C:" }
282
+
283
+ it "var_chef_dir is on the windows installation drive" do
284
+ expect(ChefConfig::Config.var_chef_dir(windows: true)).to eql("#{windows_drive}\\#{dirname}")
278
285
  end
279
286
 
280
287
  it "var_root_dir is C:\\" do
281
288
  expect(ChefConfig::Config.var_root_dir(windows: true)).to eql("C:\\")
282
289
  end
283
290
 
284
- it "etc_chef_dir is C:\\chef" do
285
- expect(ChefConfig::Config.etc_chef_dir(windows: true)).to eql("C:\\#{dirname}")
291
+ it "etc_chef_dir is on the windows installation drive" do
292
+ expect(ChefConfig::Config.etc_chef_dir(windows: true)).to eql("#{windows_drive}\\#{dirname}")
286
293
  end
287
294
  end
288
295
 
@@ -728,9 +735,9 @@ RSpec.describe ChefConfig::Config do
728
735
 
729
736
  end
730
737
 
731
- # On Windows, we'll detect an omnibus build and set this to the
738
+ # On Windows, we'll detect embedded install and set this to the
732
739
  # cacert.pem included in the package, but it's nil if you're on Windows
733
- # w/o omnibus (e.g., doing development on Windows, custom build, etc.)
740
+ # w/o embedded install (e.g., doing development on Windows, custom build, etc.)
734
741
  unless is_windows
735
742
  it "ChefConfig::Config[:ssl_ca_file] defaults to nil" do
736
743
  expect(ChefConfig::Config[:ssl_ca_file]).to be_nil
@@ -860,7 +867,7 @@ RSpec.describe ChefConfig::Config do
860
867
  describe "finding the windows embedded dir" do
861
868
  let(:default_config_location) { "c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/config.rb" }
862
869
  let(:alternate_install_location) { "c:/my/alternate/install/place/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/config.rb" }
863
- let(:non_omnibus_location) { "c:/my/dev/stuff/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/config.rb" }
870
+ let(:non_package_location) { "c:/my/dev/stuff/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/config.rb" }
864
871
 
865
872
  let(:default_ca_file) { "c:/opscode/chef/embedded/ssl/certs/cacert.pem" }
866
873
 
@@ -874,8 +881,8 @@ RSpec.describe ChefConfig::Config do
874
881
  expect(ChefConfig::Config.embedded_dir).to eq("c:/my/alternate/install/place/chef/embedded")
875
882
  end
876
883
 
877
- it "doesn't error when not in an omnibus install" do
878
- allow(ChefConfig::Config).to receive(:_this_file).and_return(non_omnibus_location)
884
+ it "doesn't error when not in an package install" do
885
+ allow(ChefConfig::Config).to receive(:_this_file).and_return(non_package_location)
879
886
  expect(ChefConfig::Config.embedded_dir).to be_nil
880
887
  end
881
888
 
@@ -0,0 +1,70 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2009-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require "spec_helper"
18
+ require "chef-config/mixin/fuzzy_hostname_matcher"
19
+
20
+ RSpec.describe ChefConfig::Mixin::FuzzyHostnameMatcher do
21
+ let(:matcher) do
22
+ Class.new { include ChefConfig::Mixin::FuzzyHostnameMatcher }.new
23
+ end
24
+
25
+ describe "#fuzzy_hostname_match?" do
26
+ it "matches a hostname with a wildcard pattern" do
27
+ expect(matcher.fuzzy_hostname_match?("foo.example.com", "example.com")).to be true
28
+ end
29
+
30
+ it "does not match unrelated hostnames" do
31
+ expect(matcher.fuzzy_hostname_match?("foo.example.com", "other.com")).to be false
32
+ end
33
+
34
+ it "returns false for bare IPv6 addresses instead of raising" do
35
+ expect(matcher.fuzzy_hostname_match?("2001:db8::1", "example.com")).to be false
36
+ end
37
+
38
+ it "returns false for bracketed IPv6 addresses instead of raising" do
39
+ expect(matcher.fuzzy_hostname_match?("[2001:db8::1]", "example.com")).to be false
40
+ end
41
+
42
+ it "returns false for IPv6 URLs instead of raising" do
43
+ expect(matcher.fuzzy_hostname_match?("https://[2001:db8::1]/path", "example.com")).to be false
44
+ end
45
+ end
46
+
47
+ describe "#fuzzy_hostname_match_any?" do
48
+ it "returns false when hostname is nil" do
49
+ expect(matcher.fuzzy_hostname_match_any?(nil, "example.com")).to be false
50
+ end
51
+
52
+ it "returns false when matches is nil" do
53
+ expect(matcher.fuzzy_hostname_match_any?("foo.example.com", nil)).to be false
54
+ end
55
+
56
+ it "matches against comma-separated patterns" do
57
+ expect(matcher.fuzzy_hostname_match_any?("foo.example.com", "other.com, example.com")).to be true
58
+ end
59
+
60
+ it "returns false for IPv6 URLs with hostname no_proxy patterns" do
61
+ ipv6_url = "https://[2001:db8:abcd:ef01::1]/organizations/o3"
62
+ no_proxy = "gateway.example.net,internal.example.com"
63
+ expect(matcher.fuzzy_hostname_match_any?(ipv6_url, no_proxy)).to be false
64
+ end
65
+
66
+ it "returns false for bare IPv6 with hostname no_proxy patterns" do
67
+ expect(matcher.fuzzy_hostname_match_any?("2001:db8::1", "example.com,other.net")).to be false
68
+ end
69
+ end
70
+ end
@@ -480,11 +480,10 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
480
480
  node_name = 'barney'
481
481
  client_key = "barney_rubble.pem"
482
482
  chef_server_url = "https://api.chef.io/organizations/bedrock"
483
- knife = {
484
- secret_file = "/home/barney/.chef/encrypted_data_bag_secret.pem"
485
- }
483
+
486
484
  [default.knife]
487
485
  ssh_user = "knife_ssh_user"
486
+ secret_file = "/home/barney/.chef/encrypted_data_bag_secret.pem"
488
487
  EOH
489
488
  content
490
489
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 19.1.164
4
+ version: 19.2.98
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 19.1.164
18
+ version: 19.2.98
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 19.1.164
25
+ version: 19.2.98
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: mixlib-shellout
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -95,16 +95,22 @@ dependencies:
95
95
  name: tomlrb
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - "~>"
98
+ - - ">="
99
99
  - !ruby/object:Gem::Version
100
100
  version: '1.2'
101
+ - - "<"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
101
104
  type: :runtime
102
105
  prerelease: false
103
106
  version_requirements: !ruby/object:Gem::Requirement
104
107
  requirements:
105
- - - "~>"
108
+ - - ">="
106
109
  - !ruby/object:Gem::Version
107
110
  version: '1.2'
111
+ - - "<"
112
+ - !ruby/object:Gem::Version
113
+ version: '3.0'
108
114
  - !ruby/object:Gem::Dependency
109
115
  name: racc
110
116
  requirement: !ruby/object:Gem::Requirement
@@ -145,6 +151,7 @@ files:
145
151
  - spec/unit/config_spec.rb
146
152
  - spec/unit/credentials_spec.rb
147
153
  - spec/unit/fips_spec.rb
154
+ - spec/unit/fuzzy_hostname_matcher_spec.rb
148
155
  - spec/unit/path_helper_spec.rb
149
156
  - spec/unit/workstation_config_loader_spec.rb
150
157
  homepage: https://github.com/chef/chef