chef-config 14.15.6 → 15.0.293
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +0 -0
- data/Rakefile +0 -0
- data/chef-config.gemspec +0 -0
- data/lib/chef-config.rb +0 -0
- data/lib/chef-config/config.rb +75 -41
- data/lib/chef-config/exceptions.rb +0 -0
- data/lib/chef-config/fips.rb +0 -0
- data/lib/chef-config/logger.rb +0 -0
- data/lib/chef-config/mixin/credentials.rb +1 -2
- data/lib/chef-config/mixin/dot_d.rb +0 -0
- data/lib/chef-config/mixin/fuzzy_hostname_matcher.rb +0 -0
- data/lib/chef-config/path_helper.rb +0 -0
- data/lib/chef-config/version.rb +1 -1
- data/lib/chef-config/windows.rb +0 -0
- data/lib/chef-config/workstation_config_loader.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/unit/config_spec.rb +76 -7
- data/spec/unit/fips_spec.rb +0 -0
- data/spec/unit/path_helper_spec.rb +0 -0
- data/spec/unit/workstation_config_loader_spec.rb +6 -6
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8d538e27a6a2e8c690ba80f45698f51387b0d26147b08b3f644bb8c00955f8a
|
4
|
+
data.tar.gz: b2c243f7dbf98a707ccab6aaa21b3a1344ed20e5b339e1d1854de173c303511e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b354e76b5774426d3cf185dd567e196b43d8553f742e690ad936fb2fd6f487d5130516f724f091d43f556d553cd40680781998fa1da4758a5a411652ca1f3a1
|
7
|
+
data.tar.gz: 9b5d22a239f07db27e9bbc6ca569fffe83ed55ccdfc2eee1394b1d6ca6f7a55c09613eaf47bc88c4ecc17cf512cbb6fe109a005ec3fd900cd8bd0ec93b7087bc
|
data/LICENSE
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/chef-config.gemspec
CHANGED
File without changes
|
data/lib/chef-config.rb
CHANGED
File without changes
|
data/lib/chef-config/config.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Author:: AJ Christensen (<aj@chef.io>)
|
5
5
|
# Author:: Mark Mzyk (<mmzyk@chef.io>)
|
6
6
|
# Author:: Kyle Goodwin (<kgoodwin@primerevenue.com>)
|
7
|
-
# Copyright:: Copyright 2008-
|
7
|
+
# Copyright:: Copyright 2008-2019, Chef Software Inc.
|
8
8
|
# License:: Apache License, Version 2.0
|
9
9
|
#
|
10
10
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -85,10 +85,13 @@ module ChefConfig
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
# @param name [String]
|
89
|
+
# @param file_path [String]
|
88
90
|
def self.add_formatter(name, file_path = nil)
|
89
91
|
formatters << [name, file_path]
|
90
92
|
end
|
91
93
|
|
94
|
+
# @param logger [String]
|
92
95
|
def self.add_event_logger(logger)
|
93
96
|
event_handlers << logger
|
94
97
|
end
|
@@ -125,18 +128,21 @@ module ChefConfig
|
|
125
128
|
|
126
129
|
default :formatters, []
|
127
130
|
|
131
|
+
# @param uri [String] the URI to validate
|
132
|
+
#
|
133
|
+
# @return [Boolean] is the URL valid
|
128
134
|
def self.is_valid_url?(uri)
|
129
135
|
url = uri.to_s.strip
|
130
136
|
/^http:\/\// =~ url || /^https:\/\// =~ url || /^chefzero:/ =~ url
|
131
137
|
end
|
138
|
+
|
132
139
|
# Override the config dispatch to set the value of multiple server options simultaneously
|
133
140
|
#
|
134
|
-
#
|
135
|
-
# url<String>:: String to be set for all of the chef-server-api URL's
|
141
|
+
# @param [String] url String to be set for all of the chef-server-api URL's
|
136
142
|
#
|
137
143
|
configurable(:chef_server_url).writes_value do |uri|
|
138
144
|
unless is_valid_url? uri
|
139
|
-
raise ConfigurationError, "#{uri} is an invalid chef_server_url."
|
145
|
+
raise ConfigurationError, "#{uri} is an invalid chef_server_url. The URL must start with http://, https://, or chefzero://."
|
140
146
|
end
|
141
147
|
uri.to_s.strip
|
142
148
|
end
|
@@ -184,6 +190,7 @@ module ChefConfig
|
|
184
190
|
path
|
185
191
|
end
|
186
192
|
|
193
|
+
# @param child_path [String]
|
187
194
|
def self.derive_path_from_chef_repo_path(child_path)
|
188
195
|
if chef_repo_path.kind_of?(String)
|
189
196
|
PathHelper.join(chef_repo_path, child_path)
|
@@ -286,15 +293,18 @@ module ChefConfig
|
|
286
293
|
# the cache path.
|
287
294
|
unless path_accessible?(primary_cache_path) || path_accessible?(primary_cache_root)
|
288
295
|
secondary_cache_path = PathHelper.join(user_home, ".chef")
|
296
|
+
secondary_cache_path = target_mode? ? "#{secondary_cache_path}/#{target_mode.host}" : secondary_cache_path
|
289
297
|
ChefConfig.logger.trace("Unable to access cache at #{primary_cache_path}. Switching cache to #{secondary_cache_path}")
|
290
298
|
secondary_cache_path
|
291
299
|
else
|
292
|
-
primary_cache_path
|
300
|
+
target_mode? ? "#{primary_cache_path}/#{target_mode.host}" : primary_cache_path
|
293
301
|
end
|
294
302
|
end
|
295
303
|
end
|
296
304
|
|
297
305
|
# Returns true only if the path exists and is readable and writeable for the user.
|
306
|
+
#
|
307
|
+
# @param path [String]
|
298
308
|
def self.path_accessible?(path)
|
299
309
|
File.exists?(path) && File.readable?(path) && File.writable?(path)
|
300
310
|
end
|
@@ -358,7 +368,7 @@ module ChefConfig
|
|
358
368
|
# Whether or not to send the Authorization header again on http redirects.
|
359
369
|
# As per the plan in https://github.com/chef/chef/pull/7006, this will be
|
360
370
|
# False in Chef 14, True in Chef 15, and will be removed entirely in Chef 16.
|
361
|
-
default :http_disable_auth_on_redirect,
|
371
|
+
default :http_disable_auth_on_redirect, true
|
362
372
|
|
363
373
|
default :interval, nil
|
364
374
|
default :once, nil
|
@@ -369,6 +379,11 @@ module ChefConfig
|
|
369
379
|
default :diff_disabled, false
|
370
380
|
default :diff_filesize_threshold, 10000000
|
371
381
|
default :diff_output_threshold, 1000000
|
382
|
+
|
383
|
+
# This is true for "local mode" which uses a chef-zero server listening on
|
384
|
+
# localhost one way or another. This is true for both `chef-solo` (without
|
385
|
+
# the --legacy-mode flag) or `chef-client -z` methods of starting a client run.
|
386
|
+
#
|
372
387
|
default :local_mode, false
|
373
388
|
|
374
389
|
# Configures the mode of operation for ChefFS, which is applied to the
|
@@ -421,6 +436,22 @@ module ChefConfig
|
|
421
436
|
# * Chef 11 mode doesn't expose RBAC objects
|
422
437
|
default :osc_compat, false
|
423
438
|
end
|
439
|
+
|
440
|
+
# RFCxxx Target Mode support, value is the name of a remote device to Chef against
|
441
|
+
# --target exists as a shortcut to enabling target_mode and setting the host
|
442
|
+
configurable(:target)
|
443
|
+
|
444
|
+
config_context :target_mode do
|
445
|
+
config_strict_mode false # we don't want to have to add all train configuration keys here
|
446
|
+
default :enabled, false
|
447
|
+
default :protocol, "ssh"
|
448
|
+
# typical additional keys: host, user, password
|
449
|
+
end
|
450
|
+
|
451
|
+
def self.target_mode?
|
452
|
+
target_mode.enabled
|
453
|
+
end
|
454
|
+
|
424
455
|
default :chef_server_url, "https://localhost:443"
|
425
456
|
|
426
457
|
default(:chef_server_root) do
|
@@ -436,11 +467,29 @@ module ChefConfig
|
|
436
467
|
end
|
437
468
|
|
438
469
|
default :rest_timeout, 300
|
439
|
-
|
440
|
-
|
470
|
+
|
471
|
+
# This solo setting is now almost entirely useless. It is set to true if chef-solo was
|
472
|
+
# invoked that way from the command-line (i.e. from Application::Solo as opposed to
|
473
|
+
# Application::Client). The more useful information is contained in the :solo_legacy_mode
|
474
|
+
# vs the :local_mode flags which will be set to true or false depending on how solo was
|
475
|
+
# invoked and actually change more of the behavior. There might be slight differences in
|
476
|
+
# the behavior of :local_mode due to the behavioral differences in Application::Solo vs.
|
477
|
+
# Application::Client and `chef-solo` vs `chef-client -z`, but checking this value and
|
478
|
+
# switching based on it is almost certainly doing the wrong thing and papering over
|
479
|
+
# bugs that should be fixed in one or the other class, and will be brittle and destined
|
480
|
+
# to break in the future (and not necessarily on a major version bump). Checking this value
|
481
|
+
# is also not sufficent to determine if we are not running against a server since this can
|
482
|
+
# be unset but :local_mode may be set. It would be accurate to check both :solo and :local_mode
|
483
|
+
# to determine if we're not running against a server, but the more semantically accurate test
|
484
|
+
# is going to be combining :solo_legacy_mode and :local_mode.
|
485
|
+
#
|
486
|
+
# TL;DR: `if Chef::Config[:solo]` is almost certainly buggy code, you should use:
|
487
|
+
# `if Chef::Config[:local_mode] || Chef::Config[:solo_legacy_mode]`
|
488
|
+
#
|
489
|
+
# @api private
|
441
490
|
default :solo, false
|
442
491
|
|
443
|
-
#
|
492
|
+
# This is true for old chef-solo legacy mode without any chef-zero server (chef-solo --legacy-mode)
|
444
493
|
default :solo_legacy_mode, false
|
445
494
|
|
446
495
|
default :splay, nil
|
@@ -450,14 +499,6 @@ module ChefConfig
|
|
450
499
|
default :ez, false
|
451
500
|
default :enable_reporting, true
|
452
501
|
default :enable_reporting_url_fatals, false
|
453
|
-
# Possible values for :audit_mode
|
454
|
-
# :enabled, :disabled, :audit_only,
|
455
|
-
#
|
456
|
-
# TODO: 11 Dec 2014: Currently audit-mode is an experimental feature
|
457
|
-
# and is disabled by default. When users choose to enable audit-mode,
|
458
|
-
# a warning is issued in application/client#reconfigure.
|
459
|
-
# This can be removed when audit-mode is enabled by default.
|
460
|
-
default :audit_mode, :disabled
|
461
502
|
|
462
503
|
# Chef only needs ohai to run the hostname plugin for the most basic
|
463
504
|
# functionality. If the rest of the ohai plugins are not needed (like in
|
@@ -491,12 +532,6 @@ module ChefConfig
|
|
491
532
|
|
492
533
|
default :named_run_list, nil
|
493
534
|
|
494
|
-
# During initial development, users were required to set `use_policyfile true`
|
495
|
-
# in `client.rb` to opt-in to policyfile use. Chef Client now examines
|
496
|
-
# configuration, node json, and the stored node to determine if policyfile
|
497
|
-
# usage is desired. This flag is still honored if set, but is unnecessary.
|
498
|
-
default :use_policyfile, false
|
499
|
-
|
500
535
|
# Policyfiles can be used in a native mode (default) or compatibility mode.
|
501
536
|
# Native mode requires Chef Server 12.1 (it can be enabled via feature flag
|
502
537
|
# on some prior versions). In native mode, policies and associated
|
@@ -607,7 +642,15 @@ module ChefConfig
|
|
607
642
|
# `node_name` of the client.
|
608
643
|
#
|
609
644
|
# If chef-zero is enabled, this defaults to nil (no authentication).
|
610
|
-
default(:client_key)
|
645
|
+
default(:client_key) do
|
646
|
+
if chef_zero.enabled
|
647
|
+
nil
|
648
|
+
elsif target_mode?
|
649
|
+
platform_specific_path("/etc/chef/#{target_mode.host}/client.pem")
|
650
|
+
else
|
651
|
+
platform_specific_path("/etc/chef/client.pem")
|
652
|
+
end
|
653
|
+
end
|
611
654
|
|
612
655
|
# A credentials file may contain a complete client key, rather than the path
|
613
656
|
# to one.
|
@@ -627,7 +670,9 @@ module ChefConfig
|
|
627
670
|
|
628
671
|
# This secret is used to decrypt encrypted data bag items.
|
629
672
|
default(:encrypted_data_bag_secret) do
|
630
|
-
if File.exist?(platform_specific_path("/etc/chef/encrypted_data_bag_secret"))
|
673
|
+
if target_mode? && File.exist?(platform_specific_path("/etc/chef/#{target_mode.host}/encrypted_data_bag_secret"))
|
674
|
+
platform_specific_path("/etc/chef/#{target_mode.host}/encrypted_data_bag_secret")
|
675
|
+
elsif File.exist?(platform_specific_path("/etc/chef/encrypted_data_bag_secret"))
|
631
676
|
platform_specific_path("/etc/chef/encrypted_data_bag_secret")
|
632
677
|
else
|
633
678
|
nil
|
@@ -767,7 +812,6 @@ module ChefConfig
|
|
767
812
|
default :bootstrap_template, nil
|
768
813
|
default :secret, nil
|
769
814
|
default :secret_file, nil
|
770
|
-
default :identity_file, nil
|
771
815
|
default :host_key_verify, nil
|
772
816
|
default :forward_agent, nil
|
773
817
|
default :sort_status_reverse, nil
|
@@ -829,7 +873,6 @@ module ChefConfig
|
|
829
873
|
#
|
830
874
|
# NOTE: CHANGING THIS SETTING MAY CAUSE CORRUPTION, DATA LOSS AND
|
831
875
|
# INSTABILITY.
|
832
|
-
#
|
833
876
|
default :file_atomic_update, true
|
834
877
|
|
835
878
|
# There are 3 possible values for this configuration setting.
|
@@ -837,28 +880,19 @@ module ChefConfig
|
|
837
880
|
# false => file staging is done via tempfiles under ENV['TMP']
|
838
881
|
# :auto => file staging will try using destination directory if possible and
|
839
882
|
# will fall back to ENV['TMP'] if destination directory is not usable.
|
840
|
-
#
|
841
883
|
default :file_staging_uses_destdir, :auto
|
842
884
|
|
843
885
|
# Exit if another run is in progress and the chef-client is unable to
|
844
886
|
# get the lock before time expires. If nil, no timeout is enforced. (Exits
|
845
887
|
# immediately if 0.)
|
846
|
-
#
|
847
888
|
default :run_lock_timeout, nil
|
848
889
|
|
849
890
|
# Number of worker threads for syncing cookbooks in parallel. Increasing
|
850
891
|
# this number can result in gateway errors from the server (namely 503 and 504).
|
851
892
|
# If you are seeing this behavior while using the default setting, reducing
|
852
893
|
# the number of threads will help.
|
853
|
-
#
|
854
894
|
default :cookbook_sync_threads, 10
|
855
895
|
|
856
|
-
# True if all resources by default default to unified mode, with all resources
|
857
|
-
# applying in "compile" mode, with no "converge" mode. False is backwards compatible
|
858
|
-
# setting for Chef 11-15 behavior. This will break forward notifications.
|
859
|
-
#
|
860
|
-
default :resource_unified_mode_default, false
|
861
|
-
|
862
896
|
# At the beginning of the Chef Client run, the cookbook manifests are downloaded which
|
863
897
|
# contain URLs for every file in every relevant cookbook. Most of the files
|
864
898
|
# (recipes, resources, providers, libraries, etc) are immediately synchronized
|
@@ -884,9 +918,9 @@ module ChefConfig
|
|
884
918
|
default :no_lazy_load, true
|
885
919
|
|
886
920
|
# A whitelisted array of attributes you want sent over the wire when node
|
887
|
-
# data is saved.
|
888
|
-
#
|
889
|
-
#
|
921
|
+
# data is saved.
|
922
|
+
# The default setting is nil, which collects all data. Setting to [] will not
|
923
|
+
# collect any data for save.
|
890
924
|
default :automatic_attribute_whitelist, nil
|
891
925
|
default :default_attribute_whitelist, nil
|
892
926
|
default :normal_attribute_whitelist, nil
|
@@ -929,7 +963,7 @@ module ChefConfig
|
|
929
963
|
# data collector will not run.
|
930
964
|
# Ex: http://my-data-collector.mycompany.com/ingest
|
931
965
|
default(:server_url) do
|
932
|
-
if config_parent.
|
966
|
+
if config_parent.solo_legacy_mode || config_parent.local_mode
|
933
967
|
nil
|
934
968
|
else
|
935
969
|
File.join(config_parent.chef_server_url, "/data-collector")
|
@@ -960,7 +994,7 @@ module ChefConfig
|
|
960
994
|
# generated by the DataCollector when Chef is run in Solo mode. This
|
961
995
|
# allows users to associate their Solo nodes with faux organizations
|
962
996
|
# without the nodes being connected to an actual Chef Server.
|
963
|
-
default :organization,
|
997
|
+
default :organization, "chef_solo"
|
964
998
|
end
|
965
999
|
|
966
1000
|
configurable(:http_proxy)
|
File without changes
|
data/lib/chef-config/fips.rb
CHANGED
File without changes
|
data/lib/chef-config/logger.rb
CHANGED
File without changes
|
@@ -89,8 +89,7 @@ module ChefConfig
|
|
89
89
|
# Unknown profile name. For "default" just silently ignore, otherwise
|
90
90
|
# raise an error.
|
91
91
|
return if profile == "default"
|
92
|
-
|
93
|
-
raise ChefConfig::ConfigurationError, "Profile #{profile} doesn't exist. Please add it to #{credentials_file_path}."
|
92
|
+
raise ChefConfig::ConfigurationError, "Profile #{profile} doesn't exist. Please add it to #{credentials_file}."
|
94
93
|
end
|
95
94
|
apply_credentials(config[profile], profile)
|
96
95
|
end
|
File without changes
|
File without changes
|
File without changes
|
data/lib/chef-config/version.rb
CHANGED
data/lib/chef-config/windows.rb
CHANGED
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
data/spec/unit/config_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
3
|
# Author:: Kyle Goodwin (<kgoodwin@primerevenue.com>)
|
4
|
-
# Copyright:: Copyright 2008-
|
4
|
+
# Copyright:: Copyright 2008-2019, Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -248,9 +248,10 @@ RSpec.describe ChefConfig::Config do
|
|
248
248
|
end
|
249
249
|
|
250
250
|
describe "default values" do
|
251
|
+
let(:system_drive) { ChefConfig::Config.env["SYSTEMDRIVE"] } if is_windows
|
251
252
|
let :primary_cache_path do
|
252
253
|
if is_windows
|
253
|
-
"#{
|
254
|
+
"#{system_drive}\\chef"
|
254
255
|
else
|
255
256
|
"/var/chef"
|
256
257
|
end
|
@@ -275,6 +276,35 @@ RSpec.describe ChefConfig::Config do
|
|
275
276
|
allow(ChefConfig::Config).to receive(:path_accessible?).and_return(false)
|
276
277
|
end
|
277
278
|
|
279
|
+
describe "ChefConfig::Config[:client_key]" do
|
280
|
+
let(:path_to_client_key) { to_platform("/etc/chef") + ChefConfig::PathHelper.path_separator }
|
281
|
+
|
282
|
+
it "sets the default path to the client key" do
|
283
|
+
expect(ChefConfig::Config.client_key).to eq(path_to_client_key + "client.pem")
|
284
|
+
end
|
285
|
+
|
286
|
+
context "when target mode is enabled" do
|
287
|
+
let(:target_mode_host) { "fluffy.kittens.org" }
|
288
|
+
|
289
|
+
before do
|
290
|
+
ChefConfig::Config.target_mode.enabled = true
|
291
|
+
ChefConfig::Config.target_mode.host = target_mode_host
|
292
|
+
end
|
293
|
+
|
294
|
+
it "sets the default path to the client key with the target host name" do
|
295
|
+
expect(ChefConfig::Config.client_key).to eq(path_to_client_key + target_mode_host + ChefConfig::PathHelper.path_separator + "client.pem")
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
context "when local mode is enabled" do
|
300
|
+
before { ChefConfig::Config[:local_mode] = true }
|
301
|
+
|
302
|
+
it "returns nil" do
|
303
|
+
expect(ChefConfig::Config.client_key).to be_nil
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
278
308
|
describe "ChefConfig::Config[:fips]" do
|
279
309
|
let(:fips_enabled) { false }
|
280
310
|
|
@@ -370,16 +400,32 @@ RSpec.describe ChefConfig::Config do
|
|
370
400
|
end
|
371
401
|
|
372
402
|
describe "ChefConfig::Config[:cache_path]" do
|
403
|
+
let(:target_mode_host) { "fluffy.kittens.org" }
|
404
|
+
let(:target_mode_primary_cache_path) { "#{primary_cache_path}/#{target_mode_host}" }
|
405
|
+
let(:target_mode_secondary_cache_path) { "#{secondary_cache_path}/#{target_mode_host}" }
|
406
|
+
|
373
407
|
before do
|
374
408
|
if is_windows
|
375
|
-
allow(File).to receive(:expand_path).and_return("#{
|
409
|
+
allow(File).to receive(:expand_path).and_return("#{system_drive}/Path/To/Executable")
|
376
410
|
end
|
377
411
|
end
|
412
|
+
|
378
413
|
context "when /var/chef exists and is accessible" do
|
379
|
-
|
414
|
+
before do
|
380
415
|
allow(ChefConfig::Config).to receive(:path_accessible?).with(to_platform("/var/chef")).and_return(true)
|
416
|
+
end
|
417
|
+
|
418
|
+
it "defaults to /var/chef" do
|
381
419
|
expect(ChefConfig::Config[:cache_path]).to eq(primary_cache_path)
|
382
420
|
end
|
421
|
+
|
422
|
+
context "and target mode is enabled" do
|
423
|
+
it "cache path includes the target host name" do
|
424
|
+
ChefConfig::Config.target_mode.enabled = true
|
425
|
+
ChefConfig::Config.target_mode.host = target_mode_host
|
426
|
+
expect(ChefConfig::Config[:cache_path]).to eq(target_mode_primary_cache_path)
|
427
|
+
end
|
428
|
+
end
|
383
429
|
end
|
384
430
|
|
385
431
|
context "when /var/chef does not exist and /var is accessible" do
|
@@ -399,13 +445,23 @@ RSpec.describe ChefConfig::Config do
|
|
399
445
|
end
|
400
446
|
|
401
447
|
context "when /var/chef exists and is not accessible" do
|
402
|
-
|
448
|
+
before do
|
403
449
|
allow(File).to receive(:exists?).with(to_platform("/var/chef")).and_return(true)
|
404
450
|
allow(File).to receive(:readable?).with(to_platform("/var/chef")).and_return(true)
|
405
451
|
allow(File).to receive(:writable?).with(to_platform("/var/chef")).and_return(false)
|
452
|
+
end
|
406
453
|
|
454
|
+
it "defaults to $HOME/.chef" do
|
407
455
|
expect(ChefConfig::Config[:cache_path]).to eq(secondary_cache_path)
|
408
456
|
end
|
457
|
+
|
458
|
+
context "and target mode is enabled" do
|
459
|
+
it "cache path defaults to $HOME/.chef with the target host name" do
|
460
|
+
ChefConfig::Config.target_mode.enabled = true
|
461
|
+
ChefConfig::Config.target_mode.host = target_mode_host
|
462
|
+
expect(ChefConfig::Config[:cache_path]).to eq(target_mode_secondary_cache_path)
|
463
|
+
end
|
464
|
+
end
|
409
465
|
end
|
410
466
|
|
411
467
|
context "when chef is running in local mode" do
|
@@ -1197,10 +1253,23 @@ RSpec.describe ChefConfig::Config do
|
|
1197
1253
|
|
1198
1254
|
end
|
1199
1255
|
|
1200
|
-
context "for Chef Solo" do
|
1256
|
+
context "for Chef Solo legacy mode" do
|
1257
|
+
|
1258
|
+
before do
|
1259
|
+
ChefConfig::Config[:solo_legacy_mode] = true
|
1260
|
+
end
|
1261
|
+
|
1262
|
+
it "sets the data collector server URL to nil" do
|
1263
|
+
ChefConfig::Config[:chef_server_url] = "https://chef.example/organizations/myorg"
|
1264
|
+
expect(ChefConfig::Config[:data_collector][:server_url]).to be_nil
|
1265
|
+
end
|
1266
|
+
|
1267
|
+
end
|
1268
|
+
|
1269
|
+
context "for local mode" do
|
1201
1270
|
|
1202
1271
|
before do
|
1203
|
-
ChefConfig::Config[:
|
1272
|
+
ChefConfig::Config[:local_mode] = true
|
1204
1273
|
end
|
1205
1274
|
|
1206
1275
|
it "sets the data collector server URL to nil" do
|
data/spec/unit/fips_spec.rb
CHANGED
File without changes
|
File without changes
|
@@ -459,7 +459,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
|
|
459
459
|
client_key = "barney_rubble.pem"
|
460
460
|
chef_server_url = "https://api.chef.io/organizations/bedrock"
|
461
461
|
invalid_config_option1234 = "foobar"
|
462
|
-
EOH
|
462
|
+
EOH
|
463
463
|
content
|
464
464
|
end
|
465
465
|
|
@@ -484,7 +484,7 @@ EOH
|
|
484
484
|
}
|
485
485
|
[default.knife]
|
486
486
|
ssh_user = "knife_ssh_user"
|
487
|
-
EOH
|
487
|
+
EOH
|
488
488
|
content
|
489
489
|
end
|
490
490
|
|
@@ -506,7 +506,7 @@ EOH
|
|
506
506
|
-----BEGIN RSA PRIVATE KEY-----
|
507
507
|
foo
|
508
508
|
"""
|
509
|
-
EOH
|
509
|
+
EOH
|
510
510
|
content
|
511
511
|
end
|
512
512
|
|
@@ -515,7 +515,7 @@ EOH
|
|
515
515
|
expect(ChefConfig::Config.client_key_contents).to eq(<<~EOH
|
516
516
|
-----BEGIN RSA PRIVATE KEY-----
|
517
517
|
foo
|
518
|
-
EOH
|
518
|
+
EOH
|
519
519
|
)
|
520
520
|
end
|
521
521
|
end
|
@@ -531,7 +531,7 @@ EOH
|
|
531
531
|
client_name = "explicit"
|
532
532
|
[context]
|
533
533
|
client_name = "context"
|
534
|
-
EOH
|
534
|
+
EOH
|
535
535
|
content
|
536
536
|
end
|
537
537
|
|
@@ -573,7 +573,7 @@ EOH
|
|
573
573
|
[default]
|
574
574
|
node_name = 'barney'
|
575
575
|
client_name = 'barney'
|
576
|
-
EOH
|
576
|
+
EOH
|
577
577
|
content
|
578
578
|
end
|
579
579
|
|
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: 15.0.293
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -194,8 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: '0'
|
196
196
|
requirements: []
|
197
|
-
|
198
|
-
rubygems_version: 2.7.9
|
197
|
+
rubygems_version: 3.0.3
|
199
198
|
signing_key:
|
200
199
|
specification_version: 4
|
201
200
|
summary: Chef's default configuration and config loading
|