chef-config 12.6.0 → 12.7.2
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/Rakefile +5 -6
- data/chef-config.gemspec +5 -5
- data/lib/chef-config.rb +1 -1
- data/lib/chef-config/config.rb +136 -71
- data/lib/chef-config/exceptions.rb +3 -3
- data/lib/chef-config/logger.rb +1 -4
- data/lib/chef-config/package_task.rb +27 -28
- data/lib/chef-config/path_helper.rb +28 -28
- data/lib/chef-config/version.rb +2 -2
- data/lib/chef-config/windows.rb +1 -2
- data/lib/chef-config/workstation_config_loader.rb +22 -23
- data/spec/spec_helper.rb +2 -2
- data/spec/unit/config_spec.rb +140 -37
- data/spec/unit/path_helper_spec.rb +17 -18
- data/spec/unit/workstation_config_loader_spec.rb +9 -11
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c047f779b038a699254b016224341f17dc101bf2
|
4
|
+
data.tar.gz: 3d11e2f9b0cd958b1f71011b3aeadc5670ec2c1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55c5e6793906b877d0ad42830833d1926ca8b72c157e766579e7d8f9908ebcfe53846824f99f9200b5c4d9348387a8a46248a0121e27a6b824d33b6ff23c6351
|
7
|
+
data.tar.gz: 13952e4469c1830144d67531f10b8376acf7e11592edf10f05661c72d1bcd0160bd6531e12df093f340190306b277a26516d3aa5781eea266cc9f803f5d5e112
|
data/Rakefile
CHANGED
@@ -1,14 +1,13 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rspec/core/rake_task"
|
2
|
+
require "chef-config/package_task"
|
3
3
|
|
4
|
-
ChefConfig::PackageTask.new(File.expand_path(
|
5
|
-
package.module_path =
|
4
|
+
ChefConfig::PackageTask.new(File.expand_path("..", __FILE__), "ChefConfig") do |package|
|
5
|
+
package.module_path = "chef-config"
|
6
6
|
end
|
7
7
|
|
8
8
|
task :default => :spec
|
9
9
|
|
10
10
|
desc "Run standard specs"
|
11
11
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
12
|
-
t.pattern = FileList[
|
12
|
+
t.pattern = FileList["spec/**/*_spec.rb"]
|
13
13
|
end
|
14
|
-
|
data/chef-config.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "chef-config/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "chef-config"
|
@@ -20,12 +20,12 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "rake", "~> 10.0"
|
22
22
|
|
23
|
-
%w
|
23
|
+
%w{rspec-core rspec-expectations rspec-mocks}.each do |rspec|
|
24
24
|
spec.add_development_dependency(rspec, "~> 3.2")
|
25
25
|
end
|
26
26
|
|
27
|
-
spec.files = %w
|
28
|
-
|
27
|
+
spec.files = %w{Rakefile LICENSE README.md} + Dir.glob("*.gemspec") +
|
28
|
+
Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
|
29
29
|
|
30
30
|
spec.bindir = "bin"
|
31
31
|
spec.executables = []
|
data/lib/chef-config.rb
CHANGED
data/lib/chef-config/config.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
#
|
2
|
-
# Author:: Adam Jacob (<adam@
|
3
|
-
# Author:: Christopher Brown (<cb@
|
4
|
-
# Author:: AJ Christensen (<aj@
|
5
|
-
# Author:: Mark Mzyk (<mmzyk@
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Christopher Brown (<cb@chef.io>)
|
4
|
+
# Author:: AJ Christensen (<aj@chef.io>)
|
5
|
+
# Author:: Mark Mzyk (<mmzyk@chef.io>)
|
6
6
|
# Author:: Kyle Goodwin (<kgoodwin@primerevenue.com>)
|
7
|
-
# Copyright:: Copyright
|
7
|
+
# Copyright:: Copyright 2008-2016, 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");
|
@@ -19,14 +19,15 @@
|
|
19
19
|
# See the License for the specific language governing permissions and
|
20
20
|
# limitations under the License.
|
21
21
|
|
22
|
-
require
|
23
|
-
require
|
22
|
+
require "mixlib/config"
|
23
|
+
require "pathname"
|
24
24
|
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
29
|
-
require
|
25
|
+
require "chef-config/logger"
|
26
|
+
require "chef-config/windows"
|
27
|
+
require "chef-config/path_helper"
|
28
|
+
require "mixlib/shellout"
|
29
|
+
require "uri"
|
30
|
+
require "openssl"
|
30
31
|
|
31
32
|
module ChefConfig
|
32
33
|
|
@@ -49,14 +50,14 @@ module ChefConfig
|
|
49
50
|
path = PathHelper.cleanpath(path)
|
50
51
|
if ChefConfig.windows?
|
51
52
|
# turns \etc\chef\client.rb and \var\chef\client.rb into C:/chef/client.rb
|
52
|
-
if env[
|
53
|
-
path = PathHelper.join(env[
|
53
|
+
if env["SYSTEMDRIVE"] && path[0] == '\\' && path.split('\\')[2] == "chef"
|
54
|
+
path = PathHelper.join(env["SYSTEMDRIVE"], path.split('\\', 3)[2])
|
54
55
|
end
|
55
56
|
end
|
56
57
|
path
|
57
58
|
end
|
58
59
|
|
59
|
-
def self.add_formatter(name, file_path=nil)
|
60
|
+
def self.add_formatter(name, file_path = nil)
|
60
61
|
formatters << [name, file_path]
|
61
62
|
end
|
62
63
|
|
@@ -77,7 +78,7 @@ module ChefConfig
|
|
77
78
|
|
78
79
|
default :formatters, []
|
79
80
|
|
80
|
-
def self.is_valid_url?
|
81
|
+
def self.is_valid_url?(uri)
|
81
82
|
url = uri.to_s.strip
|
82
83
|
/^http:\/\// =~ url || /^https:\/\// =~ url || /^chefzero:/ =~ url
|
83
84
|
end
|
@@ -107,12 +108,14 @@ module ChefConfig
|
|
107
108
|
default :chef_repo_path do
|
108
109
|
if self.configuration[:cookbook_path]
|
109
110
|
if self.configuration[:cookbook_path].kind_of?(String)
|
110
|
-
File.expand_path(
|
111
|
+
File.expand_path("..", self.configuration[:cookbook_path])
|
111
112
|
else
|
112
113
|
self.configuration[:cookbook_path].map do |path|
|
113
|
-
File.expand_path(
|
114
|
+
File.expand_path("..", path)
|
114
115
|
end
|
115
116
|
end
|
117
|
+
elsif configuration[:cookbook_artifact_path]
|
118
|
+
File.expand_path("..", self.configuration[:cookbook_artifact_path])
|
116
119
|
else
|
117
120
|
cache_path
|
118
121
|
end
|
@@ -122,8 +125,8 @@ module ChefConfig
|
|
122
125
|
# In local mode, we auto-discover the repo root by looking for a path with "cookbooks" under it.
|
123
126
|
# This allows us to run config-free.
|
124
127
|
path = cwd
|
125
|
-
until File.directory?(PathHelper.join(path, "cookbooks"))
|
126
|
-
new_path = File.expand_path(
|
128
|
+
until File.directory?(PathHelper.join(path, "cookbooks")) || File.directory?(PathHelper.join(path, "cookbook_artifacts"))
|
129
|
+
new_path = File.expand_path("..", path)
|
127
130
|
if new_path == path
|
128
131
|
ChefConfig.logger.warn("No cookbooks directory found at or above current directory. Assuming #{Dir.pwd}.")
|
129
132
|
return Dir.pwd
|
@@ -138,65 +141,73 @@ module ChefConfig
|
|
138
141
|
if chef_repo_path.kind_of?(String)
|
139
142
|
PathHelper.join(chef_repo_path, child_path)
|
140
143
|
else
|
141
|
-
chef_repo_path.uniq.map { |path| PathHelper.join(path, child_path)}
|
144
|
+
chef_repo_path.uniq.map { |path| PathHelper.join(path, child_path) }
|
142
145
|
end
|
143
146
|
end
|
144
147
|
|
145
148
|
# Location of acls on disk. String or array of strings.
|
146
149
|
# Defaults to <chef_repo_path>/acls.
|
147
|
-
|
148
|
-
default(:acl_path) { derive_path_from_chef_repo_path('acls') }
|
150
|
+
default(:acl_path) { derive_path_from_chef_repo_path("acls") }
|
149
151
|
|
150
152
|
# Location of clients on disk. String or array of strings.
|
151
153
|
# Defaults to <chef_repo_path>/acls.
|
152
|
-
default(:client_path) { derive_path_from_chef_repo_path(
|
154
|
+
default(:client_path) { derive_path_from_chef_repo_path("clients") }
|
155
|
+
|
156
|
+
# Location of containers on disk. String or array of strings.
|
157
|
+
# Defaults to <chef_repo_path>/containers.
|
158
|
+
default(:container_path) { derive_path_from_chef_repo_path("containers") }
|
159
|
+
|
160
|
+
# Location of cookbook_artifacts on disk. String or array of strings.
|
161
|
+
# Defaults to <chef_repo_path>/cookbook_artifacts.
|
162
|
+
default(:cookbook_artifact_path) { derive_path_from_chef_repo_path("cookbook_artifacts") }
|
153
163
|
|
154
164
|
# Location of cookbooks on disk. String or array of strings.
|
155
165
|
# Defaults to <chef_repo_path>/cookbooks. If chef_repo_path
|
156
166
|
# is not specified, this is set to [/var/chef/cookbooks, /var/chef/site-cookbooks]).
|
157
167
|
default(:cookbook_path) do
|
158
168
|
if self.configuration[:chef_repo_path]
|
159
|
-
derive_path_from_chef_repo_path(
|
169
|
+
derive_path_from_chef_repo_path("cookbooks")
|
160
170
|
else
|
161
|
-
Array(derive_path_from_chef_repo_path(
|
162
|
-
Array(derive_path_from_chef_repo_path(
|
171
|
+
Array(derive_path_from_chef_repo_path("cookbooks")).flatten +
|
172
|
+
Array(derive_path_from_chef_repo_path("site-cookbooks")).flatten
|
163
173
|
end
|
164
174
|
end
|
165
175
|
|
166
|
-
# Location of containers on disk. String or array of strings.
|
167
|
-
# Defaults to <chef_repo_path>/containers.
|
168
|
-
# Only applies to Enterprise Chef commands.
|
169
|
-
default(:container_path) { derive_path_from_chef_repo_path('containers') }
|
170
|
-
|
171
176
|
# Location of data bags on disk. String or array of strings.
|
172
177
|
# Defaults to <chef_repo_path>/data_bags.
|
173
|
-
default(:data_bag_path) { derive_path_from_chef_repo_path(
|
178
|
+
default(:data_bag_path) { derive_path_from_chef_repo_path("data_bags") }
|
174
179
|
|
175
180
|
# Location of environments on disk. String or array of strings.
|
176
181
|
# Defaults to <chef_repo_path>/environments.
|
177
|
-
default(:environment_path) { derive_path_from_chef_repo_path(
|
182
|
+
default(:environment_path) { derive_path_from_chef_repo_path("environments") }
|
178
183
|
|
179
184
|
# Location of groups on disk. String or array of strings.
|
180
185
|
# Defaults to <chef_repo_path>/groups.
|
181
|
-
|
182
|
-
default(:group_path) { derive_path_from_chef_repo_path('groups') }
|
186
|
+
default(:group_path) { derive_path_from_chef_repo_path("groups") }
|
183
187
|
|
184
188
|
# Location of nodes on disk. String or array of strings.
|
185
189
|
# Defaults to <chef_repo_path>/nodes.
|
186
|
-
default(:node_path) { derive_path_from_chef_repo_path(
|
190
|
+
default(:node_path) { derive_path_from_chef_repo_path("nodes") }
|
191
|
+
|
192
|
+
# Location of policies on disk. String or array of strings.
|
193
|
+
# Defaults to <chef_repo_path>/policies.
|
194
|
+
default(:policy_path) { derive_path_from_chef_repo_path("policies") }
|
195
|
+
|
196
|
+
# Location of policy_groups on disk. String or array of strings.
|
197
|
+
# Defaults to <chef_repo_path>/policy_groups.
|
198
|
+
default(:policy_group_path) { derive_path_from_chef_repo_path("policy_groups") }
|
187
199
|
|
188
200
|
# Location of roles on disk. String or array of strings.
|
189
201
|
# Defaults to <chef_repo_path>/roles.
|
190
|
-
default(:role_path) { derive_path_from_chef_repo_path(
|
202
|
+
default(:role_path) { derive_path_from_chef_repo_path("roles") }
|
191
203
|
|
192
204
|
# Location of users on disk. String or array of strings.
|
193
205
|
# Defaults to <chef_repo_path>/users.
|
194
|
-
|
195
|
-
default(:user_path) { derive_path_from_chef_repo_path('users') }
|
206
|
+
default(:user_path) { derive_path_from_chef_repo_path("users") }
|
196
207
|
|
197
208
|
# Location of policies on disk. String or array of strings.
|
198
209
|
# Defaults to <chef_repo_path>/policies.
|
199
|
-
default(:policy_path) { derive_path_from_chef_repo_path(
|
210
|
+
default(:policy_path) { derive_path_from_chef_repo_path("policies") }
|
200
211
|
|
201
212
|
# Turn on "path sanity" by default. See also: http://wiki.opscode.com/display/chef/User+Environment+PATH+Sanity
|
202
213
|
default :enforce_path_sanity, true
|
@@ -214,7 +225,7 @@ module ChefConfig
|
|
214
225
|
# this is under the user's home directory.
|
215
226
|
default(:cache_path) do
|
216
227
|
if local_mode
|
217
|
-
PathHelper.join(config_dir,
|
228
|
+
PathHelper.join(config_dir, "local-mode-cache")
|
218
229
|
else
|
219
230
|
primary_cache_root = platform_specific_path("/var")
|
220
231
|
primary_cache_path = platform_specific_path("/var/chef")
|
@@ -223,7 +234,7 @@ module ChefConfig
|
|
223
234
|
# Otherwise, we'll create .chef under the user's home directory and use that as
|
224
235
|
# the cache path.
|
225
236
|
unless path_accessible?(primary_cache_path) || path_accessible?(primary_cache_root)
|
226
|
-
secondary_cache_path = PathHelper.join(user_home,
|
237
|
+
secondary_cache_path = PathHelper.join(user_home, ".chef")
|
227
238
|
ChefConfig.logger.info("Unable to access cache at #{primary_cache_path}. Switching cache to #{secondary_cache_path}")
|
228
239
|
secondary_cache_path
|
229
240
|
else
|
@@ -297,6 +308,28 @@ module ChefConfig
|
|
297
308
|
default :diff_output_threshold, 1000000
|
298
309
|
default :local_mode, false
|
299
310
|
|
311
|
+
# Configures the mode of operation for ChefFS, which is applied to the
|
312
|
+
# ChefFS-based knife commands and chef-client's local mode. (ChefFS-based
|
313
|
+
# knife commands include: knife delete, knife deps, knife diff, knife down,
|
314
|
+
# knife edit, knife list, knife show, knife upload, and knife xargs.)
|
315
|
+
#
|
316
|
+
# Valid values are:
|
317
|
+
# * "static": ChefFS only manages objects that exist in a traditional Chef
|
318
|
+
# Repo as of Chef 11.
|
319
|
+
# * "everything": ChefFS manages all object types that existed on the OSS
|
320
|
+
# Chef 11 server.
|
321
|
+
# * "hosted_everything": ChefFS manages all object types as of the Chef 12
|
322
|
+
# Server, including RBAC objects and Policyfile objects (new to Chef 12).
|
323
|
+
default :repo_mode do
|
324
|
+
if local_mode && !chef_zero.osc_compat
|
325
|
+
"hosted_everything"
|
326
|
+
elsif chef_server_url =~ /\/+organizations\/.+/
|
327
|
+
"hosted_everything"
|
328
|
+
else
|
329
|
+
"everything"
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
300
333
|
default :pid_file, nil
|
301
334
|
|
302
335
|
# Whether Chef Zero local mode should bind to a port. All internal requests
|
@@ -310,8 +343,23 @@ module ChefConfig
|
|
310
343
|
config_context :chef_zero do
|
311
344
|
config_strict_mode true
|
312
345
|
default(:enabled) { ChefConfig::Config.local_mode }
|
313
|
-
default :host,
|
346
|
+
default :host, "localhost"
|
314
347
|
default :port, 8889.upto(9999) # Will try ports from 8889-9999 until one works
|
348
|
+
|
349
|
+
# When set to a String, Chef Zero disables multitenant support. This is
|
350
|
+
# what you want when using Chef Zero to serve a single Chef Repo. Setting
|
351
|
+
# this to `false` enables multi-tenant.
|
352
|
+
default :single_org, "chef"
|
353
|
+
|
354
|
+
# Whether Chef Zero should operate in a mode analogous to OSS Chef Server
|
355
|
+
# 11 (true) or Chef Server 12 (false). Chef Zero can still serve
|
356
|
+
# policyfile objects in Chef 11 mode, as long as `repo_mode` is set to
|
357
|
+
# "hosted_everything". The primary differences are:
|
358
|
+
# * Chef 11 mode doesn't support multi-tennant, so there is no
|
359
|
+
# distinction between global and org-specific objects (since there are
|
360
|
+
# no orgs).
|
361
|
+
# * Chef 11 mode doesn't expose RBAC objects
|
362
|
+
default :osc_compat, false
|
315
363
|
end
|
316
364
|
default :chef_server_url, "https://localhost:443"
|
317
365
|
|
@@ -319,7 +367,7 @@ module ChefConfig
|
|
319
367
|
# if the chef_server_url is a path to an organization, aka
|
320
368
|
# 'some_url.../organizations/*' then remove the '/organization/*' by default
|
321
369
|
if self.configuration[:chef_server_url] =~ /\/organizations\/\S*$/
|
322
|
-
|
370
|
+
self.configuration[:chef_server_url].split("/")[0..-3].join("/")
|
323
371
|
elsif self.configuration[:chef_server_url] # default to whatever chef_server_url is
|
324
372
|
self.configuration[:chef_server_url]
|
325
373
|
else
|
@@ -401,7 +449,6 @@ module ChefConfig
|
|
401
449
|
# effect if `policy_document_native_api` is set to `false`.
|
402
450
|
default :deployment_group, nil
|
403
451
|
|
404
|
-
|
405
452
|
# Set these to enable SSL authentication / mutual-authentication
|
406
453
|
# with the server
|
407
454
|
|
@@ -442,21 +489,26 @@ module ChefConfig
|
|
442
489
|
# Where should chef-solo download recipes from?
|
443
490
|
default :recipe_url, nil
|
444
491
|
|
492
|
+
# Set to true if Chef is to set OpenSSL to run in FIPS mode
|
493
|
+
default(:fips) { ENV["CHEF_FIPS"] == "1" }
|
494
|
+
|
495
|
+
# Initialize openssl
|
496
|
+
def self.init_openssl
|
497
|
+
if fips
|
498
|
+
self.enable_fips_mode
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
445
502
|
# Sets the version of the signed header authentication protocol to use (see
|
446
503
|
# the 'mixlib-authorization' project for more detail). Currently, versions
|
447
|
-
# 1.0 and 1.
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
# users will generally not need to manually configure this.
|
456
|
-
#
|
457
|
-
# In the future, this configuration option may be replaced with an
|
458
|
-
# automatic negotiation scheme.
|
459
|
-
default :authentication_protocol_version, "1.0"
|
504
|
+
# 1.0, 1.1, and 1.3 are available.
|
505
|
+
default :authentication_protocol_version do
|
506
|
+
if fips
|
507
|
+
"1.3"
|
508
|
+
else
|
509
|
+
"1.1"
|
510
|
+
end
|
511
|
+
end
|
460
512
|
|
461
513
|
# This key will be used to sign requests to the Chef server. This location
|
462
514
|
# must be writable by Chef during initial setup when generating a client
|
@@ -745,7 +797,7 @@ module ChefConfig
|
|
745
797
|
# pass = password
|
746
798
|
# @api private
|
747
799
|
def self.export_proxy(scheme, path, user, pass)
|
748
|
-
path = "#{scheme}://#{path}" unless path.include?(
|
800
|
+
path = "#{scheme}://#{path}" unless path.include?("://")
|
749
801
|
# URI.split returns the following parts:
|
750
802
|
# [scheme, userinfo, host, port, registry, path, opaque, query, fragment]
|
751
803
|
parts = URI.split(URI.encode(path))
|
@@ -753,7 +805,7 @@ module ChefConfig
|
|
753
805
|
# returns a string for the port.
|
754
806
|
parts[3] = parts[3].to_i if parts[3]
|
755
807
|
if user && !user.empty?
|
756
|
-
userinfo = URI.encode(URI.encode(user),
|
808
|
+
userinfo = URI.encode(URI.encode(user), "@:")
|
757
809
|
if pass
|
758
810
|
userinfo << ":#{URI.encode(URI.encode(pass), '@:')}"
|
759
811
|
end
|
@@ -767,8 +819,8 @@ module ChefConfig
|
|
767
819
|
|
768
820
|
# @api private
|
769
821
|
def self.export_no_proxy(value)
|
770
|
-
ENV[
|
771
|
-
ENV[
|
822
|
+
ENV["no_proxy"] = value unless ENV["no_proxy"]
|
823
|
+
ENV["NO_PROXY"] = value unless ENV["NO_PROXY"]
|
772
824
|
end
|
773
825
|
|
774
826
|
# Chef requires an English-language UTF-8 locale to function properly. We attempt
|
@@ -796,12 +848,12 @@ module ChefConfig
|
|
796
848
|
cmd.error!
|
797
849
|
locales = cmd.stdout.split
|
798
850
|
case
|
799
|
-
when locales.include?(
|
800
|
-
|
801
|
-
when locales.include?(
|
802
|
-
|
803
|
-
when locales.include?(
|
804
|
-
|
851
|
+
when locales.include?("C.UTF-8")
|
852
|
+
"C.UTF-8"
|
853
|
+
when locales.include?("en_US.UTF-8"), locales.include?("en_US.utf8")
|
854
|
+
"en_US.UTF-8"
|
855
|
+
when locales.include?("en.UTF-8")
|
856
|
+
"en.UTF-8"
|
805
857
|
else
|
806
858
|
# Will match en_ZZ.UTF-8, en_ZZ.utf-8, en_ZZ.UTF8, en_ZZ.utf8
|
807
859
|
guesses = locales.select { |l| l =~ /^en_.*UTF-?8$/i }
|
@@ -811,7 +863,7 @@ module ChefConfig
|
|
811
863
|
guessed_locale.gsub(/UTF-?8$/i, "UTF-8")
|
812
864
|
else
|
813
865
|
ChefConfig.logger.warn "Please install an English UTF-8 locale for Chef to use, falling back to C locale and disabling UTF-8 support."
|
814
|
-
|
866
|
+
"C"
|
815
867
|
end
|
816
868
|
end
|
817
869
|
rescue
|
@@ -820,7 +872,7 @@ module ChefConfig
|
|
820
872
|
else
|
821
873
|
ChefConfig.logger.debug "No usable locale -a command found, assuming you have en_US.UTF-8 installed."
|
822
874
|
end
|
823
|
-
|
875
|
+
"en_US.UTF-8"
|
824
876
|
end
|
825
877
|
|
826
878
|
default :internal_locale, guess_internal_locale
|
@@ -851,5 +903,18 @@ module ChefConfig
|
|
851
903
|
def self._this_file
|
852
904
|
File.expand_path(__FILE__)
|
853
905
|
end
|
906
|
+
|
907
|
+
# Set fips mode in openssl. Do any patching necessary to make
|
908
|
+
# sure Chef runs do not crash.
|
909
|
+
# @api private
|
910
|
+
def self.enable_fips_mode
|
911
|
+
ChefConfig.logger.warn "The `fips` feature is still a work in progress. This feature is incomplete."
|
912
|
+
OpenSSL.fips_mode = true
|
913
|
+
require "digest"
|
914
|
+
require "digest/sha1"
|
915
|
+
require "digest/md5"
|
916
|
+
Digest.const_set("SHA1", OpenSSL::Digest::SHA1)
|
917
|
+
OpenSSL::Digest.const_set("MD5", Digest::MD5)
|
918
|
+
end
|
854
919
|
end
|
855
920
|
end
|