chef-config 16.1.0 → 16.3.38

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: e344a243d3403a1ed61ba3a1cc489a1308944c69ac08280b640383ef7a2dedb7
4
- data.tar.gz: c936ee0ff53682b95b6c9c3cc9706fcb93e4bf1f33505794191cce80faca28e0
3
+ metadata.gz: 3482b9ead58c2925bbfd764052e0fd08cccc21b1b5779df6165822285e54e776
4
+ data.tar.gz: 22742eaed3c541ba8252694d3c829e66943b13a3f544a1afd48759317cca0786
5
5
  SHA512:
6
- metadata.gz: 332493f5012f9cb0d48060c7ea8e535a953c35ef3d74137c437adb3f35a115aac5624e3556610b470c7ed37a99ce3004e6c13ba3c8477b2df3474782f3c0a108
7
- data.tar.gz: 7480d9d496868db76840fb21594a3175e9b04f17aefa9dc8393484a0a20df2c7aa24571dd36c92e9366349955e78efa5f0122aef3e64456f1ae8a23b4cd39dfb
6
+ metadata.gz: e605107108e2f6b6c738b4a94c0131b650b8ef9f774ef707eb25b3734d5a143ba2d8d610e34535e4a733055ddacce43d8664bea295485e82149e81a748d8d18c
7
+ data.tar.gz: ba863e9355cbe3336ee2d06cb588f7a8b0ecd40127ea486d998f4c836ada7ed315762bf72703e8659ea037b3a431278a3509c9150ea8c01c67c107d618c7f3ef
@@ -1,5 +1,4 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "chef-config/version"
5
4
 
@@ -313,9 +313,12 @@ module ChefConfig
313
313
  # Defaults to <chef_repo_path>/users.
314
314
  default(:user_path) { derive_path_from_chef_repo_path("users") }.writes_value { |path| expand_relative_paths(path) }
315
315
 
316
- # Turn on "path sanity" by default.
316
+ # DEPRECATED
317
317
  default :enforce_path_sanity, false
318
318
 
319
+ # Enforce default paths by default for all APIs, not just the default internal shell_out
320
+ default :enforce_default_paths, false
321
+
319
322
  # Formatted Chef Client output is a beta feature, disabled by default:
320
323
  default :formatter, "null"
321
324
 
@@ -450,7 +453,7 @@ module ChefConfig
450
453
  default :repo_mode do
451
454
  if local_mode && !chef_zero.osc_compat
452
455
  "hosted_everything"
453
- elsif chef_server_url =~ %r{/+organizations/.+}
456
+ elsif %r{/+organizations/.+}.match?(chef_server_url)
454
457
  "hosted_everything"
455
458
  else
456
459
  "everything"
@@ -479,7 +482,7 @@ module ChefConfig
479
482
  # 11 (true) or Chef Server 12 (false). Chef Zero can still serve
480
483
  # policyfile objects in Chef 11 mode, as long as `repo_mode` is set to
481
484
  # "hosted_everything". The primary differences are:
482
- # * Chef 11 mode doesn't support multi-tennant, so there is no
485
+ # * Chef 11 mode doesn't support multi-tenant, so there is no
483
486
  # distinction between global and org-specific objects (since there are
484
487
  # no orgs).
485
488
  # * Chef 11 mode doesn't expose RBAC objects
@@ -506,7 +509,7 @@ module ChefConfig
506
509
  default(:chef_server_root) do
507
510
  # if the chef_server_url is a path to an organization, aka
508
511
  # 'some_url.../organizations/*' then remove the '/organization/*' by default
509
- if configuration[:chef_server_url] =~ %r{/organizations/\S*$}
512
+ if %r{/organizations/\S*$}.match?(configuration[:chef_server_url])
510
513
  configuration[:chef_server_url].split("/")[0..-3].join("/")
511
514
  elsif configuration[:chef_server_url] # default to whatever chef_server_url is
512
515
  configuration[:chef_server_url]
@@ -527,7 +530,7 @@ module ChefConfig
527
530
  # switching based on it is almost certainly doing the wrong thing and papering over
528
531
  # bugs that should be fixed in one or the other class, and will be brittle and destined
529
532
  # to break in the future (and not necessarily on a major version bump). Checking this value
530
- # is also not sufficent to determine if we are not running against a server since this can
533
+ # is also not sufficient to determine if we are not running against a server since this can
531
534
  # be unset but :local_mode may be set. It would be accurate to check both :solo and :local_mode
532
535
  # to determine if we're not running against a server, but the more semantically accurate test
533
536
  # is going to be combining :solo_legacy_mode and :local_mode.
@@ -952,30 +955,39 @@ module ChefConfig
952
955
  # distribution.
953
956
  #
954
957
  # The disadvantages of lazily loading files are that users some time find it
955
- # confusing that their cookbooks are not fully synchronzied to the cache initially,
958
+ # confusing that their cookbooks are not fully synchronized to the cache initially,
956
959
  # and more importantly the time-sensitive URLs which are in the manifest may time
957
960
  # out on long Chef runs before the resource that uses the file is converged
958
961
  # (leading to many confusing 403 errors on template/cookbook_file resources).
959
962
  #
960
963
  default :no_lazy_load, true
961
964
 
962
- # A whitelisted array of attributes you want sent over the wire when node
963
- # data is saved. The default setting is nil, which collects all data. Setting
964
- # to [] will not collect any data for save.
965
- #
966
- default :automatic_attribute_whitelist, nil
967
- default :default_attribute_whitelist, nil
968
- default :normal_attribute_whitelist, nil
969
- default :override_attribute_whitelist, nil
965
+ # A array of attributes you want sent over the wire when node
966
+ # data is saved. The default setting is nil, which collects all data.
967
+ # NOTE: Setting to [] will not collect ANY data to save.
968
+ default :allowed_automatic_attributes, nil
969
+ default :allowed_default_attributes, nil
970
+ default :allowed_normal_attributes, nil
971
+ default :allowed_override_attributes, nil
970
972
 
971
- # A blacklisted array of attributes you do not want to send over the
973
+ # An array of attributes you do not want to send over the
972
974
  # wire when node data is saved
973
- # The default setting is nil, which collects all data. Setting to [] will
974
- # still collect all data for save
975
+ # The default setting is nil, which collects all data.
976
+ # NOTE: Setting to [] will still collect all data to save
977
+ default :blocked_automatic_attributes, nil
978
+ default :blocked_default_attributes, nil
979
+ default :blocked_normal_attributes, nil
980
+ default :blocked_override_attributes, nil
981
+
982
+ # deprecated config options that will be removed in Chef Infra Client 17
975
983
  default :automatic_attribute_blacklist, nil
976
984
  default :default_attribute_blacklist, nil
977
985
  default :normal_attribute_blacklist, nil
978
986
  default :override_attribute_blacklist, nil
987
+ default :automatic_attribute_whitelist, nil
988
+ default :default_attribute_whitelist, nil
989
+ default :normal_attribute_whitelist, nil
990
+ default :override_attribute_whitelist, nil
979
991
 
980
992
  # Pull down all the rubygems versions from rubygems and cache them the first time we do a gem_package or
981
993
  # chef_gem install. This is memory-expensive and will grow without bounds, but will reduce network
@@ -1109,7 +1121,7 @@ module ChefConfig
1109
1121
  end
1110
1122
 
1111
1123
  # Given a scheme, host, and port, return the correct proxy URI based on the
1112
- # set environment variables, unless exluded by no_proxy, in which case nil
1124
+ # set environment variables, unless excluded by no_proxy, in which case nil
1113
1125
  # is returned
1114
1126
  def self.proxy_uri(scheme, host, port)
1115
1127
  proxy_env_var = ENV["#{scheme}_proxy"].to_s.strip
@@ -1118,7 +1130,7 @@ module ChefConfig
1118
1130
  # proxy before parsing. The regex /^.*:\/\// matches, for example, http://. Reusing proxy
1119
1131
  # here since we are really just trying to get the string built correctly.
1120
1132
  proxy = unless proxy_env_var.empty?
1121
- if proxy_env_var =~ %r{^.*://}
1133
+ if %r{^.*://}.match?(proxy_env_var)
1122
1134
  URI.parse(proxy_env_var)
1123
1135
  else
1124
1136
  URI.parse("#{scheme}://#{proxy_env_var}")
@@ -19,5 +19,8 @@ module ChefConfig
19
19
  # The legacy conf folder: C:/opscode/chef. Specifically the "opscode" part
20
20
  # DIR_SUFFIX is appended to it in code where relevant
21
21
  LEGACY_CONF_DIR = "opscode".freeze
22
+
23
+ # Enable forcing Chef EULA
24
+ ENFORCE_LICENSE = true
22
25
  end
23
26
  end
@@ -55,18 +55,15 @@ module ChefConfig
55
55
  end
56
56
  end
57
57
 
58
- def self.join(*args)
59
- path_separator_regex = Regexp.escape(File::SEPARATOR)
60
- unless path_separator == File::SEPARATOR
61
- path_separator_regex << Regexp.escape(path_separator)
62
- end
58
+ path_separator_regex = [Regexp.escape(File::SEPARATOR), Regexp.escape(path_separator)].uniq.join
63
59
 
64
- trailing_slashes = /[#{path_separator_regex}]+$/
65
- leading_slashes = /^[#{path_separator_regex}]+/
60
+ TRAILING_SLASHES_REGEX = /[#{path_separator_regex}]+$/.freeze
61
+ LEADING_SLASHES_REGEX = /^[#{path_separator_regex}]+/.freeze
66
62
 
63
+ def self.join(*args)
67
64
  args.flatten.inject do |joined_path, component|
68
- joined_path = joined_path.sub(trailing_slashes, "")
69
- component = component.sub(leading_slashes, "")
65
+ joined_path = joined_path.sub(TRAILING_SLASHES_REGEX, "")
66
+ component = component.sub(LEADING_SLASHES_REGEX, "")
70
67
  joined_path + "#{path_separator}#{component}"
71
68
  end
72
69
  end
@@ -91,7 +88,7 @@ module ChefConfig
91
88
  def self.windows_max_length_exceeded?(path)
92
89
  # Check to see if paths without the \\?\ prefix are over the maximum allowed length for the Windows API
93
90
  # http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx
94
- unless path =~ /^\\\\?\\/
91
+ unless /^\\\\?\\/.match?(path)
95
92
  if path.length > WIN_MAX_PATH
96
93
  return true
97
94
  end
@@ -103,7 +100,7 @@ module ChefConfig
103
100
  def self.printable?(string)
104
101
  # returns true if string is free of non-printable characters (escape sequences)
105
102
  # this returns false for whitespace escape sequences as well, e.g. \n\t
106
- if string =~ /[^[:print:]]/
103
+ if /[^[:print:]]/.match?(string)
107
104
  false
108
105
  else
109
106
  true
@@ -130,16 +127,16 @@ module ChefConfig
130
127
  end
131
128
 
132
129
  # This is the INVERSE of Pathname#cleanpath, it converts forward
133
- # slashes to backwhacks for Windows. Since the Ruby API and the
130
+ # slashes to backslashes for Windows. Since the Ruby API and the
134
131
  # Windows APIs all consume forward slashes, this helper function
135
132
  # should only be used for *DISPLAY* logic to send strings back
136
- # to the user with backwhacks. Internally, filename paths should
133
+ # to the user with backslashes. Internally, filename paths should
137
134
  # generally be stored with forward slashes for consistency. It is
138
135
  # not necessary or desired to blindly convert pathnames to have
139
- # backwhacks on Windows.
136
+ # backslashes on Windows.
140
137
  #
141
138
  # Generally, if the user isn't going to be seeing it, you should be
142
- # using Pathname#cleanpath intead of this function.
139
+ # using Pathname#cleanpath instead of this function.
143
140
  def self.cleanpath(path)
144
141
  path = Pathname.new(path).cleanpath.to_s
145
142
  # ensure all forward slashes are backslashes
@@ -14,6 +14,6 @@
14
14
  # limitations under the License.
15
15
 
16
16
  module ChefConfig
17
- CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__)
18
- VERSION = "16.1.0".freeze
17
+ CHEFCONFIG_ROOT = File.expand_path("..", __dir__)
18
+ VERSION = "16.3.38".freeze
19
19
  end
@@ -175,11 +175,11 @@ RSpec.describe ChefConfig::Config do
175
175
  end
176
176
 
177
177
  context "when passes multiple cookbook_paths in config options" do
178
- let(:extra_config_options) { ["cookbook_path=[first_cookbook, secound_cookbooks]"] }
178
+ let(:extra_config_options) { ["cookbook_path=[first_cookbook, second_cookbooks]"] }
179
179
 
180
180
  it "expanded paths" do
181
181
  apply_config
182
- expect(described_class[:cookbook_path]).to eq(["#{current_directory}/first_cookbook", "#{current_directory}/secound_cookbooks"])
182
+ expect(described_class[:cookbook_path]).to eq(["#{current_directory}/first_cookbook", "#{current_directory}/second_cookbooks"])
183
183
  end
184
184
  end
185
185
  end
@@ -205,8 +205,8 @@ RSpec.describe ChefConfig::Config do
205
205
  # end
206
206
  # else
207
207
  # formatter = "null"
208
- # log_location = configured-value or defualt
209
- # log_level = info or defualt
208
+ # log_location = configured-value or default
209
+ # log_level = info or default
210
210
  # end
211
211
  #
212
212
  it "has an empty list of formatters by default" do
@@ -55,7 +55,7 @@ RSpec.describe ChefConfig::PathHelper do
55
55
  end
56
56
  end
57
57
 
58
- context "on windows" do
58
+ context "on windows", :windows_only do
59
59
 
60
60
  before(:each) do
61
61
  allow(ChefUtils).to receive(:windows?).and_return(true)
@@ -103,7 +103,7 @@ RSpec.describe ChefConfig::PathHelper do
103
103
 
104
104
  end
105
105
 
106
- context "on unix" do
106
+ context "on unix", :unix_only do
107
107
 
108
108
  before(:each) do
109
109
  allow(ChefUtils).to receive(:windows?).and_return(false)
@@ -52,7 +52,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
52
52
  end
53
53
 
54
54
  it "tests a path's existence" do
55
- expect(config_loader.path_exists?("/nope/nope/nope/nope/frab/jab/nab")).to be(false)
55
+ expect(config_loader.path_exists?("/nope/nope/nope/nope/slab/jab/nab")).to be(false)
56
56
  expect(config_loader.path_exists?(__FILE__)).to be(true)
57
57
  end
58
58
 
@@ -214,7 +214,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
214
214
 
215
215
  describe "loading the config file" do
216
216
 
217
- context "when no explicit config is specifed and no implicit config is found" do
217
+ context "when no explicit config is specified and no implicit config is found" do
218
218
 
219
219
  before do
220
220
  allow(config_loader).to receive(:path_exists?).with(an_instance_of(String)).and_return(false)
@@ -230,7 +230,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
230
230
 
231
231
  context "when an explicit config is given but it doesn't exist" do
232
232
 
233
- let(:explicit_config_location) { "/nope/nope/nope/frab/jab/nab" }
233
+ let(:explicit_config_location) { "/nope/nope/nope/slab/jab/nab" }
234
234
 
235
235
  it "raises a configuration error" do
236
236
  expect { config_loader.load }.to raise_error(ChefConfig::ConfigurationError)
@@ -402,12 +402,12 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
402
402
  end
403
403
 
404
404
  context "has a non rb file" do
405
- let(:sytax_error_content) { "{{{{{:{{" }
405
+ let(:syntax_error_content) { "{{{{{:{{" }
406
406
  let(:config_content) { "config_d_file_evaluated(true)" }
407
407
 
408
408
  let!(:not_confd_file) do
409
409
  Tempfile.new(["Chef-WorkstationConfigLoader-rspec-test", ".foorb"], tempdir).tap do |t|
410
- t.print(sytax_error_content)
410
+ t.print(syntax_error_content)
411
411
  t.close
412
412
  end
413
413
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.1.0
4
+ version: 16.3.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-15 00:00:00.000000000 Z
11
+ date: 2020-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-utils
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 16.1.0
19
+ version: 16.3.38
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.1.0
26
+ version: 16.3.38
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mixlib-shellout
29
29
  requirement: !ruby/object:Gem::Requirement