chef-config 16.4.41 → 16.5.64
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 +30 -28
- data/lib/chef-config/mixin/credentials.rb +8 -7
- data/lib/chef-config/mixin/train_transport.rb +141 -0
- data/lib/chef-config/version.rb +1 -1
- data/lib/chef-config/workstation_config_loader.rb +3 -3
- data/spec/unit/config_spec.rb +2 -2
- metadata +5 -5
- data/lib/chef-config/dist.rb +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 98200061cdf7f6987f89d2810c4f4cf06e73e946703207b1e03270bed58c2a72
|
|
4
|
+
data.tar.gz: 4c97416eaa59a81959b65596d40efe4f24e10e6e8dc1e5f9f26d5467c0f13385
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a3923de2e675cd239dde70ac73595d043da585f5350f083c093fbefe6bd86a5fdd29165e7229fc2ba082018ac645420eb6991db993ea626735cd882ff0ac047
|
|
7
|
+
data.tar.gz: b0270e4feee69bde6219ec09e07529a40e0b1849ba42ea1066638b74754c7e45c6fdb6d73ec2fb0c78c727f77c131a86d4a0399d5f4fe1b46243a8765e1e6def
|
data/lib/chef-config/config.rb
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
# limitations under the License.
|
|
21
21
|
|
|
22
22
|
require "mixlib/config" unless defined?(Mixlib::Config)
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
autoload :Pathname, "pathname"
|
|
24
|
+
autoload :ChefUtils, "chef-utils"
|
|
25
25
|
|
|
26
26
|
require_relative "fips"
|
|
27
27
|
require_relative "logger"
|
|
@@ -29,12 +29,14 @@ require_relative "windows"
|
|
|
29
29
|
require_relative "path_helper"
|
|
30
30
|
require_relative "mixin/fuzzy_hostname_matcher"
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
module Mixlib
|
|
33
|
+
autoload :ShellOut, "mixlib/shellout"
|
|
34
|
+
end
|
|
35
|
+
autoload :URI, "uri"
|
|
36
|
+
autoload :Addressable, "addressable/uri"
|
|
37
|
+
autoload :OpenSSL, "openssl"
|
|
38
|
+
autoload :YAML, "yaml"
|
|
39
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
38
40
|
|
|
39
41
|
module ChefConfig
|
|
40
42
|
|
|
@@ -80,7 +82,7 @@ module ChefConfig
|
|
|
80
82
|
# @return [String] the platform-specific path
|
|
81
83
|
#
|
|
82
84
|
def self.etc_chef_dir(windows: ChefUtils.windows?)
|
|
83
|
-
path = windows ? c_chef_dir : PathHelper.join("/etc",
|
|
85
|
+
path = windows ? c_chef_dir : PathHelper.join("/etc", ChefUtils::Dist::Infra::DIR_SUFFIX, windows: windows)
|
|
84
86
|
PathHelper.cleanpath(path, windows: windows)
|
|
85
87
|
end
|
|
86
88
|
|
|
@@ -90,7 +92,7 @@ module ChefConfig
|
|
|
90
92
|
# @return [String] the platform-specific path
|
|
91
93
|
#
|
|
92
94
|
def self.var_chef_dir(windows: ChefUtils.windows?)
|
|
93
|
-
path = windows ? c_chef_dir : PathHelper.join("/var",
|
|
95
|
+
path = windows ? c_chef_dir : PathHelper.join("/var", ChefUtils::Dist::Infra::DIR_SUFFIX, windows: windows)
|
|
94
96
|
PathHelper.cleanpath(path, windows: windows)
|
|
95
97
|
end
|
|
96
98
|
|
|
@@ -112,7 +114,7 @@ module ChefConfig
|
|
|
112
114
|
#
|
|
113
115
|
def self.c_chef_dir(windows: ChefUtils.windows?)
|
|
114
116
|
drive = windows_installation_drive || "C:"
|
|
115
|
-
PathHelper.join(drive,
|
|
117
|
+
PathHelper.join(drive, ChefUtils::Dist::Infra::DIR_SUFFIX, windows: windows)
|
|
116
118
|
end
|
|
117
119
|
|
|
118
120
|
# On windows, C:/opscode
|
|
@@ -123,7 +125,7 @@ module ChefConfig
|
|
|
123
125
|
#
|
|
124
126
|
def self.c_opscode_dir(windows: ChefUtils.windows?)
|
|
125
127
|
drive = windows_installation_drive || "C:"
|
|
126
|
-
PathHelper.join(drive,
|
|
128
|
+
PathHelper.join(drive, ChefUtils::Dist::Org::LEGACY_CONF_DIR, ChefUtils::Dist::Infra::DIR_SUFFIX, windows: windows)
|
|
127
129
|
end
|
|
128
130
|
|
|
129
131
|
# the drive where Chef is installed on a windows host. This is determined
|
|
@@ -188,7 +190,7 @@ module ChefConfig
|
|
|
188
190
|
if config_file
|
|
189
191
|
PathHelper.dirname(PathHelper.canonical_path(config_file, false))
|
|
190
192
|
else
|
|
191
|
-
PathHelper.join(PathHelper.cleanpath(user_home),
|
|
193
|
+
PathHelper.join(PathHelper.cleanpath(user_home), ChefUtils::Dist::Infra::USER_CONF_DIR, "")
|
|
192
194
|
end
|
|
193
195
|
end
|
|
194
196
|
|
|
@@ -267,7 +269,7 @@ module ChefConfig
|
|
|
267
269
|
end
|
|
268
270
|
path = new_path
|
|
269
271
|
end
|
|
270
|
-
ChefConfig.logger.info("Auto-discovered #{
|
|
272
|
+
ChefConfig.logger.info("Auto-discovered #{ChefUtils::Dist::Infra::SHORT} repository at #{path}")
|
|
271
273
|
path
|
|
272
274
|
end
|
|
273
275
|
|
|
@@ -365,7 +367,7 @@ module ChefConfig
|
|
|
365
367
|
# Otherwise, we'll create .chef under the user's home directory and use that as
|
|
366
368
|
# the cache path.
|
|
367
369
|
unless path_accessible?(primary_cache_path) || path_accessible?(primary_cache_root)
|
|
368
|
-
secondary_cache_path = PathHelper.join(user_home,
|
|
370
|
+
secondary_cache_path = PathHelper.join(user_home, ChefUtils::Dist::Infra::USER_CONF_DIR)
|
|
369
371
|
secondary_cache_path = target_mode? ? PathHelper.join(secondary_cache_path, target_mode.host) : secondary_cache_path
|
|
370
372
|
ChefConfig.logger.trace("Unable to access cache at #{primary_cache_path}. Switching cache to #{secondary_cache_path}")
|
|
371
373
|
secondary_cache_path
|
|
@@ -396,7 +398,7 @@ module ChefConfig
|
|
|
396
398
|
# If your `file_cache_path` resides on a NFS (or non-flock()-supporting
|
|
397
399
|
# fs), it's recommended to set this to something like
|
|
398
400
|
# '/tmp/chef-client-running.pid'
|
|
399
|
-
default(:lockfile) { PathHelper.join(file_cache_path, "#{
|
|
401
|
+
default(:lockfile) { PathHelper.join(file_cache_path, "#{ChefUtils::Dist::Infra::CLIENT}-running.pid") }
|
|
400
402
|
|
|
401
403
|
## Daemonization Settings ##
|
|
402
404
|
# What user should Chef run as?
|
|
@@ -793,7 +795,7 @@ module ChefConfig
|
|
|
793
795
|
if chef_server_url.to_s =~ %r{/organizations/(.*)$}
|
|
794
796
|
"#{$1}-validator"
|
|
795
797
|
else
|
|
796
|
-
"#{
|
|
798
|
+
"#{ChefUtils::Dist::Infra::SHORT}-validator"
|
|
797
799
|
end
|
|
798
800
|
end
|
|
799
801
|
|
|
@@ -867,7 +869,7 @@ module ChefConfig
|
|
|
867
869
|
default :profile, nil
|
|
868
870
|
|
|
869
871
|
default :chef_guid_path do
|
|
870
|
-
PathHelper.join(config_dir, "#{
|
|
872
|
+
PathHelper.join(config_dir, "#{ChefUtils::Dist::Infra::SHORT}_guid")
|
|
871
873
|
end
|
|
872
874
|
|
|
873
875
|
default :chef_guid, nil
|
|
@@ -1076,7 +1078,7 @@ module ChefConfig
|
|
|
1076
1078
|
# generated by the DataCollector when Chef is run in Solo mode. This
|
|
1077
1079
|
# allows users to associate their Solo nodes with faux organizations
|
|
1078
1080
|
# without the nodes being connected to an actual Chef Server.
|
|
1079
|
-
default :organization, "#{
|
|
1081
|
+
default :organization, "#{ChefUtils::Dist::Infra::SHORT}_solo"
|
|
1080
1082
|
end
|
|
1081
1083
|
|
|
1082
1084
|
configurable(:http_proxy)
|
|
@@ -1102,13 +1104,6 @@ module ChefConfig
|
|
|
1102
1104
|
export_no_proxy(no_proxy) if key?(:no_proxy) && no_proxy
|
|
1103
1105
|
end
|
|
1104
1106
|
|
|
1105
|
-
# Character classes for Addressable
|
|
1106
|
-
# See https://www.ietf.org/rfc/rfc3986.txt 3.2.1
|
|
1107
|
-
# The user part may not have a : in it
|
|
1108
|
-
USER = Addressable::URI::CharacterClasses::UNRESERVED + Addressable::URI::CharacterClasses::SUB_DELIMS
|
|
1109
|
-
# The password part may have any valid USERINFO characters
|
|
1110
|
-
PASSWORD = USER + "\\:"
|
|
1111
|
-
|
|
1112
1107
|
# Builds a proxy uri and exports it to the appropriate environment variables. Examples:
|
|
1113
1108
|
# http://username:password@hostname:port
|
|
1114
1109
|
# https://username@hostname:port
|
|
@@ -1120,15 +1115,22 @@ module ChefConfig
|
|
|
1120
1115
|
# pass = password
|
|
1121
1116
|
# @api private
|
|
1122
1117
|
def self.export_proxy(scheme, path, user, pass)
|
|
1118
|
+
# Character classes for Addressable
|
|
1119
|
+
# See https://www.ietf.org/rfc/rfc3986.txt 3.2.1
|
|
1120
|
+
# The user part may not have a : in it
|
|
1121
|
+
user_class = Addressable::URI::CharacterClasses::UNRESERVED + Addressable::URI::CharacterClasses::SUB_DELIMS
|
|
1122
|
+
# The password part may have any valid USERINFO characters
|
|
1123
|
+
password_class = user_class + "\\:"
|
|
1124
|
+
|
|
1123
1125
|
path = "#{scheme}://#{path}" unless path.include?("://")
|
|
1124
1126
|
# URI.split returns the following parts:
|
|
1125
1127
|
# [scheme, userinfo, host, port, registry, path, opaque, query, fragment]
|
|
1126
1128
|
uri = Addressable::URI.encode(path, Addressable::URI)
|
|
1127
1129
|
|
|
1128
1130
|
if user && !user.empty?
|
|
1129
|
-
userinfo = Addressable::URI.encode_component(user,
|
|
1131
|
+
userinfo = Addressable::URI.encode_component(user, user_class)
|
|
1130
1132
|
if pass
|
|
1131
|
-
userinfo << ":#{Addressable::URI.encode_component(pass,
|
|
1133
|
+
userinfo << ":#{Addressable::URI.encode_component(pass, password_class)}"
|
|
1132
1134
|
end
|
|
1133
1135
|
uri.userinfo = userinfo
|
|
1134
1136
|
end
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
#
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
autoload :Tomlrb, "tomlrb"
|
|
19
19
|
require_relative "../path_helper"
|
|
20
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
20
21
|
|
|
21
22
|
module ChefConfig
|
|
22
23
|
module Mixin
|
|
@@ -36,7 +37,7 @@ module ChefConfig
|
|
|
36
37
|
# normally set via a command-line option.
|
|
37
38
|
# @return [String]
|
|
38
39
|
def credentials_profile(profile = nil)
|
|
39
|
-
context_file = PathHelper.home(
|
|
40
|
+
context_file = PathHelper.home(ChefUtils::Dist::Infra::USER_CONF_DIR, "context").freeze
|
|
40
41
|
if !profile.nil?
|
|
41
42
|
profile
|
|
42
43
|
elsif ENV.include?("CHEF_PROFILE")
|
|
@@ -53,7 +54,7 @@ module ChefConfig
|
|
|
53
54
|
# @since 14.4
|
|
54
55
|
# @return [String]
|
|
55
56
|
def credentials_file_path
|
|
56
|
-
PathHelper.home(
|
|
57
|
+
PathHelper.home(ChefUtils::Dist::Infra::USER_CONF_DIR, "credentials").freeze
|
|
57
58
|
end
|
|
58
59
|
|
|
59
60
|
# Load and parse the credentials file.
|
|
@@ -84,17 +85,17 @@ module ChefConfig
|
|
|
84
85
|
# @return [void]
|
|
85
86
|
def load_credentials(profile = nil)
|
|
86
87
|
profile = credentials_profile(profile)
|
|
87
|
-
|
|
88
|
-
return if
|
|
88
|
+
cred_config = parse_credentials_file
|
|
89
|
+
return if cred_config.nil? # No credentials, nothing to do here.
|
|
89
90
|
|
|
90
|
-
if
|
|
91
|
+
if cred_config[profile].nil?
|
|
91
92
|
# Unknown profile name. For "default" just silently ignore, otherwise
|
|
92
93
|
# raise an error.
|
|
93
94
|
return if profile == "default"
|
|
94
95
|
|
|
95
96
|
raise ChefConfig::ConfigurationError, "Profile #{profile} doesn't exist. Please add it to #{credentials_file_path}."
|
|
96
97
|
end
|
|
97
|
-
apply_credentials(
|
|
98
|
+
apply_credentials(cred_config[profile], profile)
|
|
98
99
|
end
|
|
99
100
|
end
|
|
100
101
|
end
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Author:: Bryan McLellan <btm@loftninjas.org>
|
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
|
+
# License:: Apache License, Version 2.0
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
require_relative "credentials"
|
|
19
|
+
autoload :Train, "train"
|
|
20
|
+
require_relative "../config"
|
|
21
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
22
|
+
|
|
23
|
+
module ChefConfig
|
|
24
|
+
module Mixin
|
|
25
|
+
module TrainTransport
|
|
26
|
+
include ChefConfig::Mixin::Credentials
|
|
27
|
+
|
|
28
|
+
attr_accessor :logger
|
|
29
|
+
|
|
30
|
+
def initialize(logger)
|
|
31
|
+
@logger = logger
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
#
|
|
35
|
+
# Returns a RFC099 credentials profile as a hash
|
|
36
|
+
#
|
|
37
|
+
def load_credentials(profile)
|
|
38
|
+
# Tomlrb.load_file returns a hash with keys as strings
|
|
39
|
+
credentials = parse_credentials_file
|
|
40
|
+
if contains_split_fqdn?(credentials, profile)
|
|
41
|
+
logger.warn("Credentials file #{credentials_file_path} contains target '#{profile}' as a Hash, expected a string.")
|
|
42
|
+
logger.warn("Hostnames must be surrounded by single quotes, e.g. ['host.example.org']")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# host names must be specified in credentials file as ['foo.example.org'] with quotes
|
|
46
|
+
if !credentials.nil? && !credentials[profile].nil?
|
|
47
|
+
credentials[profile].map { |k, v| [k.to_sym, v] }.to_h # return symbolized keys to match Train.options()
|
|
48
|
+
else
|
|
49
|
+
nil
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Toml creates hashes when a key is separated by periods, e.g.
|
|
54
|
+
# [host.example.org] => { host: { example: { org: {} } } }
|
|
55
|
+
#
|
|
56
|
+
# Returns true if the above example is true
|
|
57
|
+
#
|
|
58
|
+
# A hostname has to be specified as ['host.example.org']
|
|
59
|
+
# This will be a common mistake so we should catch it
|
|
60
|
+
#
|
|
61
|
+
def contains_split_fqdn?(hash, fqdn)
|
|
62
|
+
fqdn.split(".").reduce(hash) do |h, k|
|
|
63
|
+
v = h[k]
|
|
64
|
+
if Hash === v
|
|
65
|
+
v
|
|
66
|
+
else
|
|
67
|
+
break false
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# ChefConfig::Mixin::Credentials.credentials_file_path is designed around knife,
|
|
73
|
+
# overriding it here.
|
|
74
|
+
#
|
|
75
|
+
# Credentials file preference:
|
|
76
|
+
#
|
|
77
|
+
# 1) target_mode.credentials_file
|
|
78
|
+
# 2) /etc/chef/TARGET_MODE_HOST/credentials
|
|
79
|
+
# 3) #credentials_file_path from parent ($HOME/.chef/credentials)
|
|
80
|
+
#
|
|
81
|
+
def credentials_file_path
|
|
82
|
+
tm_config = config.target_mode
|
|
83
|
+
profile = tm_config.host
|
|
84
|
+
|
|
85
|
+
credentials_file =
|
|
86
|
+
if tm_config.credentials_file && File.exist?(tm_config.credentials_file)
|
|
87
|
+
tm_config.credentials_file
|
|
88
|
+
elsif File.exist?(config.platform_specific_path("#{ChefConfig::Config.etc_chef_dir}/#{profile}/credentials"))
|
|
89
|
+
config.platform_specific_path("#{ChefConfig::Config.etc_chef_dir}/#{profile}/credentials")
|
|
90
|
+
else
|
|
91
|
+
super
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
raise ArgumentError, "No credentials file found for target '#{profile}'" unless credentials_file
|
|
95
|
+
raise ArgumentError, "Credentials file specified for target mode does not exist: '#{credentials_file}'" unless File.exist?(credentials_file)
|
|
96
|
+
|
|
97
|
+
logger.debug("Loading credentials file '#{credentials_file}' for target '#{profile}'")
|
|
98
|
+
|
|
99
|
+
credentials_file
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def build_transport
|
|
103
|
+
return nil unless config.target_mode?
|
|
104
|
+
|
|
105
|
+
# TODO: Consider supporting parsing the protocol from a URI passed to `--target`
|
|
106
|
+
#
|
|
107
|
+
train_config = {}
|
|
108
|
+
|
|
109
|
+
# Load the target_mode config context from config, and place any valid settings into the train configuration
|
|
110
|
+
tm_config = config.target_mode
|
|
111
|
+
protocol = tm_config.protocol
|
|
112
|
+
train_config = tm_config.to_hash.select { |k| Train.options(protocol).key?(k) }
|
|
113
|
+
logger.trace("Using target mode options from #{ChefUtils::Dist::Infra::PRODUCT} config file: #{train_config.keys.join(", ")}") if train_config
|
|
114
|
+
|
|
115
|
+
# Load the credentials file, and place any valid settings into the train configuration
|
|
116
|
+
credentials = load_credentials(tm_config.host)
|
|
117
|
+
if credentials
|
|
118
|
+
valid_settings = credentials.select { |k| Train.options(protocol).key?(k) }
|
|
119
|
+
valid_settings[:enable_password] = credentials[:enable_password] if credentials.key?(:enable_password)
|
|
120
|
+
train_config.merge!(valid_settings)
|
|
121
|
+
logger.trace("Using target mode options from credentials file: #{valid_settings.keys.join(", ")}") if valid_settings
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
train_config[:logger] = logger
|
|
125
|
+
|
|
126
|
+
# Train handles connection retries for us
|
|
127
|
+
Train.create(protocol, train_config)
|
|
128
|
+
rescue SocketError => e # likely a dns failure, not caught by train
|
|
129
|
+
e.message.replace "Error connecting to #{train_config[:target]} - #{e.message}"
|
|
130
|
+
raise e
|
|
131
|
+
rescue Train::PluginLoadError
|
|
132
|
+
logger.error("Invalid target mode protocol: #{protocol}")
|
|
133
|
+
exit(1)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def config
|
|
137
|
+
raise NotImplementedError
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
data/lib/chef-config/version.rb
CHANGED
|
@@ -59,7 +59,7 @@ module ChefConfig
|
|
|
59
59
|
@chef_config_dir = false
|
|
60
60
|
full_path = working_directory.split(File::SEPARATOR)
|
|
61
61
|
(full_path.length - 1).downto(0) do |i|
|
|
62
|
-
candidate_directory = File.join(full_path[0..i] + [
|
|
62
|
+
candidate_directory = File.join(full_path[0..i] + [ChefUtils::Dist::Infra::USER_CONF_DIR])
|
|
63
63
|
if File.exist?(candidate_directory) && File.directory?(candidate_directory)
|
|
64
64
|
@chef_config_dir = candidate_directory
|
|
65
65
|
break
|
|
@@ -129,7 +129,7 @@ module ChefConfig
|
|
|
129
129
|
candidate_configs << File.join(chef_config_dir, "knife.rb")
|
|
130
130
|
end
|
|
131
131
|
# Look for $HOME/.chef/knife.rb
|
|
132
|
-
PathHelper.home(
|
|
132
|
+
PathHelper.home(ChefUtils::Dist::Infra::USER_CONF_DIR) do |dot_chef_dir|
|
|
133
133
|
candidate_configs << File.join(dot_chef_dir, "config.rb")
|
|
134
134
|
candidate_configs << File.join(dot_chef_dir, "knife.rb")
|
|
135
135
|
end
|
|
@@ -184,7 +184,7 @@ module ChefConfig
|
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
def home_chef_dir
|
|
187
|
-
@home_chef_dir ||= PathHelper.home(
|
|
187
|
+
@home_chef_dir ||= PathHelper.home(ChefUtils::Dist::Infra::USER_CONF_DIR)
|
|
188
188
|
end
|
|
189
189
|
|
|
190
190
|
def apply_config(config_content, config_file_path)
|
data/spec/unit/config_spec.rb
CHANGED
|
@@ -170,7 +170,7 @@ RSpec.describe ChefConfig::Config do
|
|
|
170
170
|
apply_config
|
|
171
171
|
expect(described_class[:data_bag_path]).to eq("#{current_directory}/data_bags")
|
|
172
172
|
expect(described_class[:cookbook_path]).to eq("#{current_directory}/cookbooks")
|
|
173
|
-
expect(described_class[:chef_repo_path]).to eq(
|
|
173
|
+
expect(described_class[:chef_repo_path]).to eq(current_directory)
|
|
174
174
|
end
|
|
175
175
|
end
|
|
176
176
|
|
|
@@ -225,7 +225,7 @@ RSpec.describe ChefConfig::Config do
|
|
|
225
225
|
end
|
|
226
226
|
|
|
227
227
|
describe "#var_chef_path" do
|
|
228
|
-
let (:dirname) {
|
|
228
|
+
let (:dirname) { ChefUtils::Dist::Infra::DIR_SUFFIX }
|
|
229
229
|
|
|
230
230
|
context "on unix", :unix_only do
|
|
231
231
|
it "var_chef_dir is /var/chef" do
|
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.5.64
|
|
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-09-17 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.5.64
|
|
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.5.64
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: mixlib-shellout
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -174,13 +174,13 @@ files:
|
|
|
174
174
|
- chef-config.gemspec
|
|
175
175
|
- lib/chef-config.rb
|
|
176
176
|
- lib/chef-config/config.rb
|
|
177
|
-
- lib/chef-config/dist.rb
|
|
178
177
|
- lib/chef-config/exceptions.rb
|
|
179
178
|
- lib/chef-config/fips.rb
|
|
180
179
|
- lib/chef-config/logger.rb
|
|
181
180
|
- lib/chef-config/mixin/credentials.rb
|
|
182
181
|
- lib/chef-config/mixin/dot_d.rb
|
|
183
182
|
- lib/chef-config/mixin/fuzzy_hostname_matcher.rb
|
|
183
|
+
- lib/chef-config/mixin/train_transport.rb
|
|
184
184
|
- lib/chef-config/path_helper.rb
|
|
185
185
|
- lib/chef-config/version.rb
|
|
186
186
|
- lib/chef-config/windows.rb
|
data/lib/chef-config/dist.rb
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
module ChefConfig
|
|
2
|
-
class Dist
|
|
3
|
-
# The chef executable name.
|
|
4
|
-
EXEC = "chef".freeze
|
|
5
|
-
|
|
6
|
-
# The client's alias (chef-client)
|
|
7
|
-
CLIENT = "chef-client".freeze
|
|
8
|
-
|
|
9
|
-
# A short name for the product
|
|
10
|
-
SHORT = "chef".freeze
|
|
11
|
-
|
|
12
|
-
# The suffix for Chef's /etc/chef, /var/chef and C:\\Chef directories
|
|
13
|
-
# "cinc" => /etc/cinc, /var/cinc, C:\\cinc
|
|
14
|
-
DIR_SUFFIX = "chef".freeze
|
|
15
|
-
|
|
16
|
-
# The user's configuration directory
|
|
17
|
-
USER_CONF_DIR = ".chef".freeze
|
|
18
|
-
|
|
19
|
-
# The legacy conf folder: C:/opscode/chef. Specifically the "opscode" part
|
|
20
|
-
# DIR_SUFFIX is appended to it in code where relevant
|
|
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
|
-
end
|
|
33
|
-
end
|