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 +4 -4
- data/chef-config.gemspec +1 -2
- data/lib/chef-config/config.rb +31 -19
- data/lib/chef-config/dist.rb +3 -0
- data/lib/chef-config/path_helper.rb +12 -15
- data/lib/chef-config/version.rb +2 -2
- data/spec/unit/config_spec.rb +4 -4
- data/spec/unit/path_helper_spec.rb +2 -2
- data/spec/unit/workstation_config_loader_spec.rb +5 -5
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3482b9ead58c2925bbfd764052e0fd08cccc21b1b5779df6165822285e54e776
|
|
4
|
+
data.tar.gz: 22742eaed3c541ba8252694d3c829e66943b13a3f544a1afd48759317cca0786
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e605107108e2f6b6c738b4a94c0131b650b8ef9f774ef707eb25b3734d5a143ba2d8d610e34535e4a733055ddacce43d8664bea295485e82149e81a748d8d18c
|
|
7
|
+
data.tar.gz: ba863e9355cbe3336ee2d06cb588f7a8b0ecd40127ea486d998f4c836ada7ed315762bf72703e8659ea037b3a431278a3509c9150ea8c01c67c107d618c7f3ef
|
data/chef-config.gemspec
CHANGED
data/lib/chef-config/config.rb
CHANGED
|
@@ -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
|
-
#
|
|
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
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
963
|
-
# data is saved. The default setting is nil, which collects all data.
|
|
964
|
-
# to [] will not collect
|
|
965
|
-
|
|
966
|
-
default :
|
|
967
|
-
default :
|
|
968
|
-
default :
|
|
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
|
-
#
|
|
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.
|
|
974
|
-
# still collect all data
|
|
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
|
|
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
|
|
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}")
|
data/lib/chef-config/dist.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
65
|
-
|
|
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(
|
|
69
|
-
component = component.sub(
|
|
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
|
|
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
|
|
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
|
|
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
|
-
#
|
|
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
|
|
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
|
data/lib/chef-config/version.rb
CHANGED
data/spec/unit/config_spec.rb
CHANGED
|
@@ -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,
|
|
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}/
|
|
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
|
|
209
|
-
# log_level = info or
|
|
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/
|
|
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
|
|
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/
|
|
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(:
|
|
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(
|
|
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.
|
|
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-
|
|
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.
|
|
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.
|
|
26
|
+
version: 16.3.38
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: mixlib-shellout
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|