chef-config 16.0.275 → 16.2.50
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef-config/config.rb +7 -34
- data/lib/chef-config/path_helper.rb +7 -7
- data/lib/chef-config/version.rb +1 -1
- data/spec/unit/config_spec.rb +25 -25
- 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: 18c3baff61c72f875c86714ea490fde90759eb6fc23db0e0f06de97539824598
|
4
|
+
data.tar.gz: c55da18fa5d270826a625822622c945cd4d10eeb2f9add9f69d6f734b2a6c0f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a47d3e0353b9eddcd15846c825f3df19e79ee640d2aef2de268f5036d1ba983a9c9a33e56bcaa120ec866b1a4358bd1fc689192fabe57eac7c028d4f5c5afb40
|
7
|
+
data.tar.gz: e47086a28cfa9286d89d24b17001d249724fecc0237d66b752c1b714d7d0d4b5f096986356eae65b36798c463e2b0a8b7d635f91fb41b8cb1610c64949cb5d21
|
data/lib/chef-config/config.rb
CHANGED
@@ -450,7 +450,7 @@ module ChefConfig
|
|
450
450
|
default :repo_mode do
|
451
451
|
if local_mode && !chef_zero.osc_compat
|
452
452
|
"hosted_everything"
|
453
|
-
elsif
|
453
|
+
elsif %r{/+organizations/.+}.match?(chef_server_url)
|
454
454
|
"hosted_everything"
|
455
455
|
else
|
456
456
|
"everything"
|
@@ -479,7 +479,7 @@ module ChefConfig
|
|
479
479
|
# 11 (true) or Chef Server 12 (false). Chef Zero can still serve
|
480
480
|
# policyfile objects in Chef 11 mode, as long as `repo_mode` is set to
|
481
481
|
# "hosted_everything". The primary differences are:
|
482
|
-
# * Chef 11 mode doesn't support multi-
|
482
|
+
# * Chef 11 mode doesn't support multi-tenant, so there is no
|
483
483
|
# distinction between global and org-specific objects (since there are
|
484
484
|
# no orgs).
|
485
485
|
# * Chef 11 mode doesn't expose RBAC objects
|
@@ -506,7 +506,7 @@ module ChefConfig
|
|
506
506
|
default(:chef_server_root) do
|
507
507
|
# if the chef_server_url is a path to an organization, aka
|
508
508
|
# 'some_url.../organizations/*' then remove the '/organization/*' by default
|
509
|
-
if
|
509
|
+
if %r{/organizations/\S*$}.match?(configuration[:chef_server_url])
|
510
510
|
configuration[:chef_server_url].split("/")[0..-3].join("/")
|
511
511
|
elsif configuration[:chef_server_url] # default to whatever chef_server_url is
|
512
512
|
configuration[:chef_server_url]
|
@@ -527,7 +527,7 @@ module ChefConfig
|
|
527
527
|
# switching based on it is almost certainly doing the wrong thing and papering over
|
528
528
|
# bugs that should be fixed in one or the other class, and will be brittle and destined
|
529
529
|
# to break in the future (and not necessarily on a major version bump). Checking this value
|
530
|
-
# is also not
|
530
|
+
# is also not sufficient to determine if we are not running against a server since this can
|
531
531
|
# be unset but :local_mode may be set. It would be accurate to check both :solo and :local_mode
|
532
532
|
# to determine if we're not running against a server, but the more semantically accurate test
|
533
533
|
# is going to be combining :solo_legacy_mode and :local_mode.
|
@@ -847,33 +847,6 @@ module ChefConfig
|
|
847
847
|
|
848
848
|
# knife configuration data
|
849
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
|
877
850
|
default :hints, {}
|
878
851
|
end
|
879
852
|
|
@@ -979,7 +952,7 @@ module ChefConfig
|
|
979
952
|
# distribution.
|
980
953
|
#
|
981
954
|
# The disadvantages of lazily loading files are that users some time find it
|
982
|
-
# confusing that their cookbooks are not fully
|
955
|
+
# confusing that their cookbooks are not fully synchronized to the cache initially,
|
983
956
|
# and more importantly the time-sensitive URLs which are in the manifest may time
|
984
957
|
# out on long Chef runs before the resource that uses the file is converged
|
985
958
|
# (leading to many confusing 403 errors on template/cookbook_file resources).
|
@@ -1136,7 +1109,7 @@ module ChefConfig
|
|
1136
1109
|
end
|
1137
1110
|
|
1138
1111
|
# Given a scheme, host, and port, return the correct proxy URI based on the
|
1139
|
-
# set environment variables, unless
|
1112
|
+
# set environment variables, unless excluded by no_proxy, in which case nil
|
1140
1113
|
# is returned
|
1141
1114
|
def self.proxy_uri(scheme, host, port)
|
1142
1115
|
proxy_env_var = ENV["#{scheme}_proxy"].to_s.strip
|
@@ -1145,7 +1118,7 @@ module ChefConfig
|
|
1145
1118
|
# proxy before parsing. The regex /^.*:\/\// matches, for example, http://. Reusing proxy
|
1146
1119
|
# here since we are really just trying to get the string built correctly.
|
1147
1120
|
proxy = unless proxy_env_var.empty?
|
1148
|
-
if
|
1121
|
+
if %r{^.*://}.match?(proxy_env_var)
|
1149
1122
|
URI.parse(proxy_env_var)
|
1150
1123
|
else
|
1151
1124
|
URI.parse("#{scheme}://#{proxy_env_var}")
|
@@ -91,7 +91,7 @@ module ChefConfig
|
|
91
91
|
def self.windows_max_length_exceeded?(path)
|
92
92
|
# Check to see if paths without the \\?\ prefix are over the maximum allowed length for the Windows API
|
93
93
|
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx
|
94
|
-
unless path
|
94
|
+
unless /^\\\\?\\/.match?(path)
|
95
95
|
if path.length > WIN_MAX_PATH
|
96
96
|
return true
|
97
97
|
end
|
@@ -103,7 +103,7 @@ module ChefConfig
|
|
103
103
|
def self.printable?(string)
|
104
104
|
# returns true if string is free of non-printable characters (escape sequences)
|
105
105
|
# this returns false for whitespace escape sequences as well, e.g. \n\t
|
106
|
-
if
|
106
|
+
if /[^[:print:]]/.match?(string)
|
107
107
|
false
|
108
108
|
else
|
109
109
|
true
|
@@ -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
|
@@ -268,7 +268,7 @@ module ChefConfig
|
|
268
268
|
# Determine if the given path is protected by macOS System Integrity Protection.
|
269
269
|
def self.is_sip_path?(path, node)
|
270
270
|
if ChefUtils.macos?
|
271
|
-
|
271
|
+
# @todo: parse rootless.conf for this?
|
272
272
|
sip_paths = [
|
273
273
|
"/System", "/bin", "/sbin", "/usr"
|
274
274
|
]
|
data/lib/chef-config/version.rb
CHANGED
data/spec/unit/config_spec.rb
CHANGED
@@ -175,40 +175,40 @@ 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
|
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 default
|
209
|
+
# log_level = info or default
|
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
|
@@ -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.2.50
|
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-06-23 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.2.50
|
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.2.50
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mixlib-shellout
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|