chef-config 15.11.3 → 16.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/lib/chef-config/config.rb +13 -17
- data/lib/chef-config/path_helper.rb +9 -9
- data/lib/chef-config/version.rb +1 -1
- data/spec/unit/config_spec.rb +4 -4
- data/spec/unit/workstation_config_loader_spec.rb +5 -5
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32625e6af835a08cd5a952e48585aa44e1ca1249a4ead9a905afc09bd6713cb8
|
4
|
+
data.tar.gz: 32ec2aec397191c65220a445eca899ed0ea6107de2114c3284ce59306c699aef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e9e5180cfeda09cbed3762343dd7382759e6c4979cecb99b3af983aecbf2ab190cc3d08e5e6182c0099d584a800e8f551e79152809649a75ce142b92c3af0fb
|
7
|
+
data.tar.gz: 9986d69845556dd4da7bd89b2ff4b5f5150e799a4a391d4a169c21268083445aab8621e23e65d095a8aed234596efe581604d232b0dcf07231d2b48f9dfd19ae
|
data/Rakefile
CHANGED
data/lib/chef-config/config.rb
CHANGED
@@ -278,15 +278,8 @@ module ChefConfig
|
|
278
278
|
|
279
279
|
# Location of cookbooks on disk. String or array of strings.
|
280
280
|
# Defaults to <chef_repo_path>/cookbooks. If chef_repo_path
|
281
|
-
# is not specified, this is set to
|
282
|
-
default(:cookbook_path)
|
283
|
-
if configuration[:chef_repo_path]
|
284
|
-
derive_path_from_chef_repo_path("cookbooks")
|
285
|
-
else
|
286
|
-
Array(derive_path_from_chef_repo_path("cookbooks")).flatten +
|
287
|
-
Array(derive_path_from_chef_repo_path("site-cookbooks")).flatten
|
288
|
-
end
|
289
|
-
end
|
281
|
+
# is not specified, this is set to /var/chef/cookbooks.
|
282
|
+
default(:cookbook_path) { derive_path_from_chef_repo_path("cookbooks") }
|
290
283
|
|
291
284
|
# Location of data bags on disk. String or array of strings.
|
292
285
|
# Defaults to <chef_repo_path>/data_bags.
|
@@ -399,7 +392,7 @@ module ChefConfig
|
|
399
392
|
default :log_level, :auto
|
400
393
|
|
401
394
|
# Logging location as either an IO stream or string representing log file path
|
402
|
-
default :log_location,
|
395
|
+
default :log_location, nil
|
403
396
|
|
404
397
|
# Using `force_formatter` causes chef to default to formatter output when STDOUT is not a tty
|
405
398
|
default :force_formatter, false
|
@@ -407,6 +400,9 @@ module ChefConfig
|
|
407
400
|
# Using `force_logger` causes chef to default to logger output when STDOUT is a tty
|
408
401
|
default :force_logger, false
|
409
402
|
|
403
|
+
# When set to true always print the stacktrace even if we haven't done -l debug
|
404
|
+
default :always_dump_stacktrace, false
|
405
|
+
|
410
406
|
# Using 'stream_execute_output' will have Chef always stream the execute output
|
411
407
|
default :stream_execute_output, false
|
412
408
|
|
@@ -483,7 +479,7 @@ module ChefConfig
|
|
483
479
|
# 11 (true) or Chef Server 12 (false). Chef Zero can still serve
|
484
480
|
# policyfile objects in Chef 11 mode, as long as `repo_mode` is set to
|
485
481
|
# "hosted_everything". The primary differences are:
|
486
|
-
# * Chef 11 mode doesn't support multi-
|
482
|
+
# * Chef 11 mode doesn't support multi-tenant, so there is no
|
487
483
|
# distinction between global and org-specific objects (since there are
|
488
484
|
# no orgs).
|
489
485
|
# * Chef 11 mode doesn't expose RBAC objects
|
@@ -531,7 +527,7 @@ module ChefConfig
|
|
531
527
|
# switching based on it is almost certainly doing the wrong thing and papering over
|
532
528
|
# bugs that should be fixed in one or the other class, and will be brittle and destined
|
533
529
|
# to break in the future (and not necessarily on a major version bump). Checking this value
|
534
|
-
# is also not
|
530
|
+
# is also not sufficient to determine if we are not running against a server since this can
|
535
531
|
# be unset but :local_mode may be set. It would be accurate to check both :solo and :local_mode
|
536
532
|
# to determine if we're not running against a server, but the more semantically accurate test
|
537
533
|
# is going to be combining :solo_legacy_mode and :local_mode.
|
@@ -838,7 +834,7 @@ module ChefConfig
|
|
838
834
|
|
839
835
|
# Whether the resource count should be updated for log resource
|
840
836
|
# on running chef-client
|
841
|
-
default :count_log_resource_updates,
|
837
|
+
default :count_log_resource_updates, false
|
842
838
|
|
843
839
|
# The selected profile when using credentials.
|
844
840
|
default :profile, nil
|
@@ -956,7 +952,7 @@ module ChefConfig
|
|
956
952
|
# distribution.
|
957
953
|
#
|
958
954
|
# The disadvantages of lazily loading files are that users some time find it
|
959
|
-
# confusing that their cookbooks are not fully
|
955
|
+
# confusing that their cookbooks are not fully synchronized to the cache initially,
|
960
956
|
# and more importantly the time-sensitive URLs which are in the manifest may time
|
961
957
|
# out on long Chef runs before the resource that uses the file is converged
|
962
958
|
# (leading to many confusing 403 errors on template/cookbook_file resources).
|
@@ -1113,7 +1109,7 @@ module ChefConfig
|
|
1113
1109
|
end
|
1114
1110
|
|
1115
1111
|
# Given a scheme, host, and port, return the correct proxy URI based on the
|
1116
|
-
# set environment variables, unless
|
1112
|
+
# set environment variables, unless excluded by no_proxy, in which case nil
|
1117
1113
|
# is returned
|
1118
1114
|
def self.proxy_uri(scheme, host, port)
|
1119
1115
|
proxy_env_var = ENV["#{scheme}_proxy"].to_s.strip
|
@@ -1196,10 +1192,10 @@ module ChefConfig
|
|
1196
1192
|
default :ruby_encoding, Encoding::UTF_8
|
1197
1193
|
|
1198
1194
|
# can be set to a string or array of strings for URIs to set as rubygems sources
|
1199
|
-
default :rubygems_url,
|
1195
|
+
default :rubygems_url, nil
|
1200
1196
|
|
1201
1197
|
# globally sets the default of the clear_sources property on the gem_package and chef_gem resources
|
1202
|
-
default :clear_gem_sources,
|
1198
|
+
default :clear_gem_sources, nil
|
1203
1199
|
|
1204
1200
|
# If installed via an omnibus installer, this gives the path to the
|
1205
1201
|
# "embedded" directory which contains all of the software packaged with
|
@@ -130,16 +130,16 @@ module ChefConfig
|
|
130
130
|
end
|
131
131
|
|
132
132
|
# This is the INVERSE of Pathname#cleanpath, it converts forward
|
133
|
-
# slashes to
|
133
|
+
# slashes to backslashes for Windows. Since the Ruby API and the
|
134
134
|
# Windows APIs all consume forward slashes, this helper function
|
135
135
|
# should only be used for *DISPLAY* logic to send strings back
|
136
|
-
# to the user with
|
136
|
+
# to the user with backslashes. Internally, filename paths should
|
137
137
|
# generally be stored with forward slashes for consistency. It is
|
138
138
|
# not necessary or desired to blindly convert pathnames to have
|
139
|
-
#
|
139
|
+
# backslashes on Windows.
|
140
140
|
#
|
141
141
|
# Generally, if the user isn't going to be seeing it, you should be
|
142
|
-
# using Pathname#cleanpath
|
142
|
+
# using Pathname#cleanpath instead of this function.
|
143
143
|
def self.cleanpath(path)
|
144
144
|
path = Pathname.new(path).cleanpath.to_s
|
145
145
|
# ensure all forward slashes are backslashes
|
@@ -265,15 +265,15 @@ module ChefConfig
|
|
265
265
|
end
|
266
266
|
end
|
267
267
|
|
268
|
-
# Determine if the given path is protected by
|
268
|
+
# Determine if the given path is protected by macOS System Integrity Protection.
|
269
269
|
def self.is_sip_path?(path, node)
|
270
|
-
if
|
270
|
+
if ChefUtils.macos?
|
271
271
|
# @todo: parse rootless.conf for this?
|
272
272
|
sip_paths = [
|
273
273
|
"/System", "/bin", "/sbin", "/usr"
|
274
274
|
]
|
275
275
|
sip_paths.each do |sip_path|
|
276
|
-
ChefConfig.logger.info("
|
276
|
+
ChefConfig.logger.info("#{sip_path} is a SIP path, checking if it is in the exceptions list.")
|
277
277
|
return true if path.start_with?(sip_path)
|
278
278
|
end
|
279
279
|
false
|
@@ -282,7 +282,7 @@ module ChefConfig
|
|
282
282
|
end
|
283
283
|
end
|
284
284
|
|
285
|
-
# Determine if the given path is on the exception list for
|
285
|
+
# Determine if the given path is on the exception list for macOS System Integrity Protection.
|
286
286
|
def self.writable_sip_path?(path)
|
287
287
|
# todo: parse rootless.conf for this?
|
288
288
|
sip_exceptions = [
|
@@ -293,7 +293,7 @@ module ChefConfig
|
|
293
293
|
sip_exceptions.each do |exception_path|
|
294
294
|
return true if path.start_with?(exception_path)
|
295
295
|
end
|
296
|
-
ChefConfig.logger.error("Cannot write to a SIP
|
296
|
+
ChefConfig.logger.error("Cannot write to a SIP path #{path} on macOS!")
|
297
297
|
false
|
298
298
|
end
|
299
299
|
|
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
|
@@ -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:
|
4
|
+
version: 16.1.16
|
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-
|
11
|
+
date: 2020-05-27 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:
|
19
|
+
version: 16.1.16
|
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:
|
26
|
+
version: 16.1.16
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mixlib-shellout
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
|
-
rubygems_version: 3.
|
212
|
+
rubygems_version: 3.1.2
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: Chef's default configuration and config loading
|