chef-config 15.14.0 → 16.0.257
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/chef-config.gemspec +2 -1
- data/lib/chef-config/config.rb +41 -18
- data/lib/chef-config/dist.rb +0 -10
- data/lib/chef-config/path_helper.rb +9 -9
- data/lib/chef-config/version.rb +2 -2
- data/spec/unit/config_spec.rb +23 -23
- 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: d1967a23569bd6acc655afb4a46c884f487292399438ebef67c30753cddbae30
|
4
|
+
data.tar.gz: 8b0e0493a0a8b0ed27a8cdb9516e6910a8da60c6caf187a8953f52460dc9b1fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ae62cd75d740132b5ae1db4d9d967f1cde8529b8b5a73f82e80314e8a074cc9ad1d3403a2196fff3c7efb3c19c6aefeb927142810c7785cfd21e1416b0710e9
|
7
|
+
data.tar.gz: fbc6a73fb9db1a9d33314950b85bf358b7136630f6f2fa2ea0bcfc9e582e4a3e372ffd91d2a2e1b9292d98c0945365a22b1264ec272ad8113828dcb322e4bf64
|
data/Rakefile
CHANGED
data/chef-config.gemspec
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.
|
@@ -359,7 +352,7 @@ module ChefConfig
|
|
359
352
|
#
|
360
353
|
# @param path [String]
|
361
354
|
def self.path_accessible?(path)
|
362
|
-
File.
|
355
|
+
File.exists?(path) && File.readable?(path) && File.writable?(path)
|
363
356
|
end
|
364
357
|
|
365
358
|
# Where cookbook files are stored on the server (by content checksum)
|
@@ -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-tennant, 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 sufficent 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
|
@@ -851,6 +847,33 @@ module ChefConfig
|
|
851
847
|
|
852
848
|
# knife configuration data
|
853
849
|
config_context :knife do
|
850
|
+
# XXX: none of these default values are applied to knife (and would create a backcompat
|
851
|
+
# break in knife if this bug was fixed since many of the defaults below are wrong). this appears
|
852
|
+
# to be the start of an attempt to be able to use config_strict_mode true? if so, this approach
|
853
|
+
# is fraught with peril because this namespace is used by every knife plugin in the wild and
|
854
|
+
# we would need to validate every cli option in every knife attribute out there and list them all here.
|
855
|
+
#
|
856
|
+
# based on the way that people may define `knife[:foobar] = "something"` for the knife-foobar
|
857
|
+
# gem plugin i'm pretty certain we can never turn on anything like config_string_mode since
|
858
|
+
# any config value may be a typo or it may be in some gem in some knife plugin we don't know about.
|
859
|
+
#
|
860
|
+
# we do still need to maintain at least one of these so that the knife config hash gets
|
861
|
+
# created.
|
862
|
+
#
|
863
|
+
# this whole situation is deeply unsatisfying.
|
864
|
+
default :ssh_port, nil
|
865
|
+
default :ssh_user, nil
|
866
|
+
default :ssh_attribute, nil
|
867
|
+
default :ssh_gateway, nil
|
868
|
+
default :ssh_gateway_identity, nil
|
869
|
+
default :bootstrap_version, nil
|
870
|
+
default :bootstrap_proxy, nil
|
871
|
+
default :bootstrap_template, nil
|
872
|
+
default :secret, nil
|
873
|
+
default :secret_file, nil
|
874
|
+
default :host_key_verify, nil
|
875
|
+
default :forward_agent, nil
|
876
|
+
default :sort_status_reverse, nil
|
854
877
|
default :hints, {}
|
855
878
|
end
|
856
879
|
|
@@ -956,7 +979,7 @@ module ChefConfig
|
|
956
979
|
# distribution.
|
957
980
|
#
|
958
981
|
# The disadvantages of lazily loading files are that users some time find it
|
959
|
-
# confusing that their cookbooks are not fully
|
982
|
+
# confusing that their cookbooks are not fully synchronzied to the cache initially,
|
960
983
|
# and more importantly the time-sensitive URLs which are in the manifest may time
|
961
984
|
# out on long Chef runs before the resource that uses the file is converged
|
962
985
|
# (leading to many confusing 403 errors on template/cookbook_file resources).
|
@@ -1113,7 +1136,7 @@ module ChefConfig
|
|
1113
1136
|
end
|
1114
1137
|
|
1115
1138
|
# Given a scheme, host, and port, return the correct proxy URI based on the
|
1116
|
-
# set environment variables, unless
|
1139
|
+
# set environment variables, unless exluded by no_proxy, in which case nil
|
1117
1140
|
# is returned
|
1118
1141
|
def self.proxy_uri(scheme, host, port)
|
1119
1142
|
proxy_env_var = ENV["#{scheme}_proxy"].to_s.strip
|
@@ -1196,10 +1219,10 @@ module ChefConfig
|
|
1196
1219
|
default :ruby_encoding, Encoding::UTF_8
|
1197
1220
|
|
1198
1221
|
# can be set to a string or array of strings for URIs to set as rubygems sources
|
1199
|
-
default :rubygems_url,
|
1222
|
+
default :rubygems_url, nil
|
1200
1223
|
|
1201
1224
|
# globally sets the default of the clear_sources property on the gem_package and chef_gem resources
|
1202
|
-
default :clear_gem_sources,
|
1225
|
+
default :clear_gem_sources, nil
|
1203
1226
|
|
1204
1227
|
# If installed via an omnibus installer, this gives the path to the
|
1205
1228
|
# "embedded" directory which contains all of the software packaged with
|
data/lib/chef-config/dist.rb
CHANGED
@@ -19,15 +19,5 @@ 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
|
25
|
-
|
26
|
-
# The servers's alias (chef-server)
|
27
|
-
SERVER = "chef-server".freeze
|
28
|
-
|
29
|
-
# The server's configuration utility
|
30
|
-
SERVER_CTL = "chef-server-ctl".freeze
|
31
|
-
|
32
22
|
end
|
33
23
|
end
|
@@ -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 backwhacks 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 backwhacks. 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
|
+
# backwhacks 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 intead 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
|
@@ -267,13 +267,13 @@ module ChefConfig
|
|
267
267
|
|
268
268
|
# Determine if the given path is protected by macOS System Integrity Protection.
|
269
269
|
def self.is_sip_path?(path, node)
|
270
|
-
if
|
271
|
-
|
270
|
+
if ChefUtils.macos?
|
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 OS X 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
@@ -186,29 +186,29 @@ RSpec.describe ChefConfig::Config do
|
|
186
186
|
end
|
187
187
|
|
188
188
|
describe "when configuring formatters" do
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
189
|
+
# if TTY and not(force-logger)
|
190
|
+
# formatter = configured formatter or default formatter
|
191
|
+
# formatter goes to STDOUT/ERR
|
192
|
+
# if log file is writeable
|
193
|
+
# log level is configured level or info
|
194
|
+
# log location is file
|
195
|
+
# else
|
196
|
+
# log level is warn
|
197
|
+
# log location is STDERR
|
198
|
+
# end
|
199
|
+
# elsif not(TTY) and force formatter
|
200
|
+
# formatter = configured formatter or default formatter
|
201
|
+
# if log_location specified
|
202
|
+
# formatter goes to log_location
|
203
|
+
# else
|
204
|
+
# formatter goes to STDOUT/ERR
|
205
|
+
# end
|
206
|
+
# else
|
207
|
+
# formatter = "null"
|
208
|
+
# log_location = configured-value or defualt
|
209
|
+
# log_level = info or defualt
|
210
|
+
# end
|
211
|
+
#
|
212
212
|
it "has an empty list of formatters by default" do
|
213
213
|
expect(ChefConfig::Config.formatters).to eq([])
|
214
214
|
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.0.257
|
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-04-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.0.257
|
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.0.257
|
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
|