chef-config 15.4.45 → 15.5.9
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/chef-config.gemspec +1 -0
- data/lib/chef-config/config.rb +6 -5
- data/lib/chef-config/exceptions.rb +1 -1
- data/lib/chef-config/fips.rb +4 -2
- data/lib/chef-config/path_helper.rb +8 -7
- data/lib/chef-config/version.rb +2 -17
- data/lib/chef-config/windows.rb +4 -8
- data/lib/chef-config/workstation_config_loader.rb +3 -2
- data/spec/spec_helper.rb +3 -3
- data/spec/unit/config_spec.rb +1 -1
- data/spec/unit/fips_spec.rb +3 -3
- data/spec/unit/path_helper_spec.rb +6 -6
- data/spec/unit/workstation_config_loader_spec.rb +3 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f91e769432580aaa6c4c2b62564b354c848ece00d6cf2fe587f9cf96d7f27fca
|
4
|
+
data.tar.gz: a11b03cfe07fb1d428adeed60f9577532ec56f8330d15cbdc52c35b74dfe6a3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4aed9e8baaed79001003ae6424fe7e1eb84f0ab28d06ee6ce66af1aaaddf2758f9f983c2d469ea7686c58ec025d361939bd3f434e077374ab5fc0f5d3573ec4e
|
7
|
+
data.tar.gz: 5ddd80cf0ac7fc5b1fd7f546b8cc7fe5a593c921b3d773ef993f802b9b34b5ecc7b31b8fe82e624cf474b1cd9679cdb0a5bdb0b52079bfc05ed9d51e48e490a0
|
data/chef-config.gemspec
CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
|
16
16
|
spec.require_paths = ["lib"]
|
17
17
|
|
18
|
+
spec.add_dependency "chef-utils", "= #{ChefConfig::VERSION}"
|
18
19
|
spec.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
|
19
20
|
spec.add_dependency "mixlib-config", ">= 2.2.12", "< 4.0"
|
20
21
|
spec.add_dependency "fuzzyurl"
|
data/lib/chef-config/config.rb
CHANGED
@@ -21,6 +21,7 @@
|
|
21
21
|
|
22
22
|
require "mixlib/config" unless defined?(Mixlib::Config)
|
23
23
|
require "pathname" unless defined?(Pathname)
|
24
|
+
require "chef-utils" unless defined?(ChefUtils::CANARY)
|
24
25
|
|
25
26
|
require_relative "fips"
|
26
27
|
require_relative "logger"
|
@@ -60,7 +61,7 @@ module ChefConfig
|
|
60
61
|
# @return [String] a platform specific path
|
61
62
|
def self.platform_specific_path(path)
|
62
63
|
path = PathHelper.cleanpath(path)
|
63
|
-
if
|
64
|
+
if ChefUtils.windows?
|
64
65
|
# turns \etc\chef\client.rb and \var\chef\client.rb into C:/chef/client.rb
|
65
66
|
# Some installations will be on different drives so use the drive that
|
66
67
|
# the expanded path to __FILE__ is found.
|
@@ -78,7 +79,7 @@ module ChefConfig
|
|
78
79
|
#
|
79
80
|
# @return [String] the drive letter
|
80
81
|
def self.windows_installation_drive
|
81
|
-
if
|
82
|
+
if ChefUtils.windows?
|
82
83
|
drive = File.expand_path(__FILE__).split("/", 2)[0]
|
83
84
|
drive = ENV["SYSTEMDRIVE"] if drive.to_s == ""
|
84
85
|
drive
|
@@ -573,7 +574,7 @@ module ChefConfig
|
|
573
574
|
# Path to the default CA bundle files.
|
574
575
|
default :ssl_ca_path, nil
|
575
576
|
default(:ssl_ca_file) do
|
576
|
-
if
|
577
|
+
if ChefUtils.windows? && embedded_dir
|
577
578
|
cacert_path = File.join(embedded_dir, "ssl/certs/cacert.pem")
|
578
579
|
cacert_path if File.exist?(cacert_path)
|
579
580
|
else
|
@@ -841,7 +842,7 @@ module ChefConfig
|
|
841
842
|
|
842
843
|
# Those lists of regular expressions define what chef considers a
|
843
844
|
# valid user and group name
|
844
|
-
if
|
845
|
+
if ChefUtils.windows?
|
845
846
|
set_defaults_for_windows
|
846
847
|
else
|
847
848
|
set_defaults_for_nix
|
@@ -1138,7 +1139,7 @@ module ChefConfig
|
|
1138
1139
|
end
|
1139
1140
|
end
|
1140
1141
|
rescue
|
1141
|
-
if
|
1142
|
+
if ChefUtils.windows?
|
1142
1143
|
ChefConfig.logger.trace "Defaulting to locale en_US.UTF-8 on Windows, until it matters that we do something else."
|
1143
1144
|
else
|
1144
1145
|
ChefConfig.logger.trace "No usable locale -a command found, assuming you have en_US.UTF-8 installed."
|
data/lib/chef-config/fips.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Matt Wrock (<matt@mattwrock.com>)
|
3
|
-
# Copyright:: Copyright (c) 2016 Chef Software
|
3
|
+
# Copyright:: Copyright (c) 2016-2018, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -16,10 +16,12 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
+
require "chef-utils" unless defined?(ChefUtils::CANARY)
|
20
|
+
|
19
21
|
module ChefConfig
|
20
22
|
|
21
23
|
def self.fips?
|
22
|
-
if
|
24
|
+
if ChefUtils.windows?
|
23
25
|
begin
|
24
26
|
require "win32/registry" unless defined?(Win32::Registry)
|
25
27
|
rescue LoadError
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Bryan McLellan <btm@loftninjas.org>
|
3
|
-
# Copyright:: Copyright 2014-
|
3
|
+
# Copyright:: Copyright 2014-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -16,6 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
+
require "chef-utils" unless defined?(ChefUtils::CANARY)
|
19
20
|
require_relative "windows"
|
20
21
|
require_relative "logger"
|
21
22
|
require_relative "exceptions"
|
@@ -26,7 +27,7 @@ module ChefConfig
|
|
26
27
|
WIN_MAX_PATH = 259
|
27
28
|
|
28
29
|
def self.dirname(path)
|
29
|
-
if
|
30
|
+
if ChefUtils.windows?
|
30
31
|
# Find the first slash, not counting trailing slashes
|
31
32
|
end_slash = path.size
|
32
33
|
loop do
|
@@ -47,7 +48,7 @@ module ChefConfig
|
|
47
48
|
BACKSLASH = '\\'.freeze
|
48
49
|
|
49
50
|
def self.path_separator
|
50
|
-
if
|
51
|
+
if ChefUtils.windows?
|
51
52
|
File::ALT_SEPARATOR || BACKSLASH
|
52
53
|
else
|
53
54
|
File::SEPARATOR
|
@@ -71,7 +72,7 @@ module ChefConfig
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def self.validate_path(path)
|
74
|
-
if
|
75
|
+
if ChefUtils.windows?
|
75
76
|
unless printable?(path)
|
76
77
|
msg = "Path '#{path}' contains non-printable characters. Check that backslashes are escaped with another backslash (e.g. C:\\\\Windows) in double-quoted strings."
|
77
78
|
ChefConfig.logger.error(msg)
|
@@ -114,7 +115,7 @@ module ChefConfig
|
|
114
115
|
# First remove extra separators and resolve any relative paths
|
115
116
|
abs_path = File.absolute_path(path)
|
116
117
|
|
117
|
-
if
|
118
|
+
if ChefUtils.windows?
|
118
119
|
# Add the \\?\ API prefix on Windows unless add_prefix is false
|
119
120
|
# Downcase on Windows where paths are still case-insensitive
|
120
121
|
abs_path.gsub!(::File::SEPARATOR, path_separator)
|
@@ -142,7 +143,7 @@ module ChefConfig
|
|
142
143
|
def self.cleanpath(path)
|
143
144
|
path = Pathname.new(path).cleanpath.to_s
|
144
145
|
# ensure all forward slashes are backslashes
|
145
|
-
if
|
146
|
+
if ChefUtils.windows?
|
146
147
|
path = path.gsub(File::SEPARATOR, path_separator)
|
147
148
|
end
|
148
149
|
path
|
@@ -219,7 +220,7 @@ module ChefConfig
|
|
219
220
|
paths = []
|
220
221
|
paths << ENV[@@per_tool_home_environment] if defined?(@@per_tool_home_environment) && @@per_tool_home_environment && ENV[@@per_tool_home_environment]
|
221
222
|
paths << ENV["CHEF_HOME"] if ENV["CHEF_HOME"]
|
222
|
-
if
|
223
|
+
if ChefUtils.windows?
|
223
224
|
# By default, Ruby uses the the following environment variables to determine Dir.home:
|
224
225
|
# HOME
|
225
226
|
# HOMEDRIVE HOMEPATH
|
data/lib/chef-config/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright 2010-
|
1
|
+
# Copyright:: Copyright 2010-2018, Chef Software Inc.
|
2
2
|
# License:: Apache License, Version 2.0
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -13,22 +13,7 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
17
|
-
# NOTE: This file is generated by running `rake version` in the top level of
|
18
|
-
# this repo. Do not edit this manually. Edit the VERSION file and run the rake
|
19
|
-
# task instead.
|
20
|
-
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
21
|
-
|
22
16
|
module ChefConfig
|
23
17
|
CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__)
|
24
|
-
VERSION = "15.
|
18
|
+
VERSION = "15.5.9".freeze
|
25
19
|
end
|
26
|
-
|
27
|
-
#
|
28
|
-
# NOTE: the Chef::Version class is defined in version_class.rb
|
29
|
-
#
|
30
|
-
# NOTE: DO NOT Use the Chef::Version class on ChefConfig::VERSIONs. The
|
31
|
-
# Chef::Version class is for _cookbooks_ only, and cannot handle
|
32
|
-
# pre-release versions like "10.14.0.rc.2". Please use Rubygem's
|
33
|
-
# Gem::Version class instead.
|
34
|
-
#
|
data/lib/chef-config/windows.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright 2015-
|
2
|
+
# Copyright:: Copyright 2015-2018, Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -15,14 +15,10 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
|
18
|
+
require "chef-utils" unless defined?(ChefUtils::CANARY)
|
19
19
|
|
20
|
+
module ChefConfig
|
20
21
|
def self.windows?
|
21
|
-
|
22
|
-
true
|
23
|
-
else
|
24
|
-
false
|
25
|
-
end
|
22
|
+
ChefUtils.windows?
|
26
23
|
end
|
27
|
-
|
28
24
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Daniel DeLeo (<dan@chef.io>)
|
3
|
-
# Copyright:: Copyright 2014-
|
3
|
+
# Copyright:: Copyright 2014-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -16,6 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
+
require "chef-utils" unless defined?(ChefUtils::CANARY)
|
19
20
|
require_relative "config"
|
20
21
|
require_relative "exceptions"
|
21
22
|
require_relative "logger"
|
@@ -139,7 +140,7 @@ module ChefConfig
|
|
139
140
|
end
|
140
141
|
|
141
142
|
def working_directory
|
142
|
-
a = if
|
143
|
+
a = if ChefUtils.windows?
|
143
144
|
env["CD"]
|
144
145
|
else
|
145
146
|
env["PWD"]
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require "chef-
|
1
|
+
require "chef-utils"
|
2
2
|
|
3
3
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
4
4
|
RSpec.configure do |config|
|
@@ -32,8 +32,8 @@ RSpec.configure do |config|
|
|
32
32
|
config.filter_run :focus
|
33
33
|
config.run_all_when_everything_filtered = true
|
34
34
|
|
35
|
-
config.filter_run_excluding windows_only: true unless
|
36
|
-
config.filter_run_excluding unix_only: true if
|
35
|
+
config.filter_run_excluding windows_only: true unless ChefUtils.windows?
|
36
|
+
config.filter_run_excluding unix_only: true if ChefUtils.windows?
|
37
37
|
|
38
38
|
# Limits the available syntax to the non-monkey patched syntax that is
|
39
39
|
# recommended. For more details, see:
|
data/spec/unit/config_spec.rb
CHANGED
@@ -201,7 +201,7 @@ RSpec.describe ChefConfig::Config do
|
|
201
201
|
end
|
202
202
|
|
203
203
|
before :each do
|
204
|
-
allow(
|
204
|
+
allow(ChefUtils).to receive(:windows?).and_return(is_windows)
|
205
205
|
end
|
206
206
|
describe "class method: windows_installation_drive" do
|
207
207
|
before do
|
data/spec/unit/fips_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Matt Wrock (<matt@mattwrock.com>)
|
3
|
-
# Copyright:: Copyright (c) 2016-
|
3
|
+
# Copyright:: Copyright (c) 2016-2018, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -32,7 +32,7 @@ RSpec.describe "ChefConfig.fips?" do
|
|
32
32
|
let(:fips_path) { "/proc/sys/crypto/fips_enabled" }
|
33
33
|
|
34
34
|
before(:each) do
|
35
|
-
allow(
|
35
|
+
allow(ChefUtils).to receive(:windows?).and_return(false)
|
36
36
|
allow(::File).to receive(:exist?).with(fips_path).and_return(true)
|
37
37
|
allow(::File).to receive(:read).with(fips_path).and_return(enabled)
|
38
38
|
end
|
@@ -69,7 +69,7 @@ RSpec.describe "ChefConfig.fips?" do
|
|
69
69
|
let(:win_reg_entry) { { "Enabled" => enabled } }
|
70
70
|
|
71
71
|
before(:each) do
|
72
|
-
allow(
|
72
|
+
allow(ChefUtils).to receive(:windows?).and_return(true)
|
73
73
|
allow(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).with(fips_key, arch).and_yield(win_reg_entry)
|
74
74
|
end
|
75
75
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Bryan McLellan <btm@loftninjas.org>
|
3
|
-
# Copyright:: Copyright 2014-
|
3
|
+
# Copyright:: Copyright 2014-2018, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -58,7 +58,7 @@ RSpec.describe ChefConfig::PathHelper do
|
|
58
58
|
context "on windows" do
|
59
59
|
|
60
60
|
before(:each) do
|
61
|
-
allow(
|
61
|
+
allow(ChefUtils).to receive(:windows?).and_return(true)
|
62
62
|
end
|
63
63
|
|
64
64
|
include_examples("common_functionality")
|
@@ -106,7 +106,7 @@ RSpec.describe ChefConfig::PathHelper do
|
|
106
106
|
context "on unix" do
|
107
107
|
|
108
108
|
before(:each) do
|
109
|
-
allow(
|
109
|
+
allow(ChefUtils).to receive(:windows?).and_return(false)
|
110
110
|
end
|
111
111
|
|
112
112
|
include_examples("common_functionality")
|
@@ -144,7 +144,7 @@ RSpec.describe ChefConfig::PathHelper do
|
|
144
144
|
context "on windows" do
|
145
145
|
before(:each) do
|
146
146
|
# pass by default
|
147
|
-
allow(
|
147
|
+
allow(ChefUtils).to receive(:windows?).and_return(true)
|
148
148
|
allow(path_helper).to receive(:printable?).and_return(true)
|
149
149
|
allow(path_helper).to receive(:windows_max_length_exceeded?).and_return(false)
|
150
150
|
end
|
@@ -254,7 +254,7 @@ RSpec.describe ChefConfig::PathHelper do
|
|
254
254
|
context "when given more than one argument" do
|
255
255
|
it "joins, cleanpaths, and escapes characters reserved by glob" do
|
256
256
|
args = ["this/*path", "[needs]", "escaping?"]
|
257
|
-
escaped_path = if
|
257
|
+
escaped_path = if ChefUtils.windows?
|
258
258
|
"this\\\\\\*path\\\\\\[needs\\]\\\\escaping\\?"
|
259
259
|
else
|
260
260
|
"this/\\*path/\\[needs\\]/escaping\\?"
|
@@ -286,7 +286,7 @@ RSpec.describe ChefConfig::PathHelper do
|
|
286
286
|
describe "all_homes" do
|
287
287
|
before do
|
288
288
|
stub_const("ENV", env)
|
289
|
-
allow(
|
289
|
+
allow(ChefUtils).to receive(:windows?).and_return(is_windows)
|
290
290
|
end
|
291
291
|
|
292
292
|
context "on windows" do
|
@@ -20,7 +20,7 @@ require "spec_helper"
|
|
20
20
|
require "tempfile"
|
21
21
|
|
22
22
|
require "chef-config/exceptions"
|
23
|
-
require "chef-
|
23
|
+
require "chef-utils"
|
24
24
|
require "chef-config/workstation_config_loader"
|
25
25
|
|
26
26
|
RSpec.describe ChefConfig::WorkstationConfigLoader do
|
@@ -98,7 +98,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
|
|
98
98
|
let(:env_pwd) { "/path/to/cwd" }
|
99
99
|
|
100
100
|
before do
|
101
|
-
if
|
101
|
+
if ChefUtils.windows?
|
102
102
|
env["CD"] = env_pwd
|
103
103
|
else
|
104
104
|
env["PWD"] = env_pwd
|
@@ -431,7 +431,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
|
|
431
431
|
end
|
432
432
|
|
433
433
|
describe "when loading a credentials file" do
|
434
|
-
if
|
434
|
+
if ChefUtils.windows?
|
435
435
|
let(:home) { "C:/Users/example.user" }
|
436
436
|
else
|
437
437
|
let(:home) { "/Users/example.user" }
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 15.
|
4
|
+
version: 15.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: chef-utils
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 15.5.9
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 15.5.9
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: mixlib-shellout
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|