chef-config 16.0.287 → 16.2.73
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/lib/chef-config/config.rb +7 -34
- data/lib/chef-config/path_helper.rb +6 -6
- 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 +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34623e012cced934ded201d9f807e6849d4143680bb6fdcae6bcb1c2e94455f4
|
4
|
+
data.tar.gz: a8bc46c08bb15aaa9b924df7385c2e4d84b0adababb0d4ad72641f7d8ab025c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 921156386ae8b49a43e875579b3eaabf5b1133987c443eb1859db10ec9a4df73644587159a8508b28a26c14d003d18f5f226951dc76c368bebc0b5a4543139b1
|
7
|
+
data.tar.gz: 49b91ea9d7758068bff1708387a0160995b4fbb1113ed26363bec8441850e9d6164e483cf6dc9953519400f25dd054030dc57d1e7899dcba4a133b977367c391
|
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
|
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: 16.
|
4
|
+
version: 16.2.73
|
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-01 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.73
|
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.73
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mixlib-shellout
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|