chef-utils 19.3.15 → 19.4.46
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-utils.gemspec +1 -1
- data/lib/chef-utils/dsl/default_paths.rb +19 -1
- data/lib/chef-utils/dsl/train_helpers.rb +2 -1
- data/lib/chef-utils/version.rb +1 -1
- data/spec/unit/dsl/path_sanity_spec.rb +22 -6
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e446f182d09c3b793a7deabde425f761ed3dafe680abb2b6ec438c9f82b11182
|
|
4
|
+
data.tar.gz: 32a13986d1bd2e311617bc5ef7414cbcffbed25f9e173ec7efa955614a36e512
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70e1e7d84daf1ca99ff734d42504afe9c677d11fc10cfc3c2775358784261d58634fa073eee68930ed65d31ab8bb59db0f6869a9af0f95acdc44700406e0c948
|
|
7
|
+
data.tar.gz: e8b0b0972a16dcaaf898ff8d3ec5fc3dba7268c5c0f68c12a62f7709def601d05c160519a800f57262aa5c5c48affe26ab0630339f6c36b15801fe734bd7f224
|
data/chef-utils.gemspec
CHANGED
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
|
|
|
43
43
|
|
|
44
44
|
# concurrent-ruby is: 1. lightweight, 2. has zero deps, 3. is external to chef
|
|
45
45
|
# this is used for the parallel_map enumerable extension for lightweight threading
|
|
46
|
-
spec.add_dependency "concurrent-ruby"
|
|
46
|
+
spec.add_dependency "concurrent-ruby", ">= 1.3.7"
|
|
47
47
|
|
|
48
48
|
spec.files = %w{Rakefile LICENSE} + Dir.glob("*.gemspec") +
|
|
49
49
|
Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
|
|
@@ -43,7 +43,25 @@ module ChefUtils
|
|
|
43
43
|
private
|
|
44
44
|
|
|
45
45
|
def __default_paths
|
|
46
|
-
ChefUtils.windows?
|
|
46
|
+
if ChefUtils.windows?
|
|
47
|
+
# On Windows with Habitat-based packaging (Chef 19+), the Habitat launcher
|
|
48
|
+
# overwrites the process PATH with only the package's bin dirs, stripping
|
|
49
|
+
# standard Windows system directories. We restore them here using SystemRoot
|
|
50
|
+
# (an OS-level env var set by Windows itself, always present and unaffected
|
|
51
|
+
# by Habitat's PATH overwrite), mirroring what Linux already does for
|
|
52
|
+
# /usr/bin, /sbin, etc.
|
|
53
|
+
# Note: we intentionally do NOT add WindowsPowerShell here because Chef 19
|
|
54
|
+
# (Habitat-based) ships its own bundled PowerShell and adding the system
|
|
55
|
+
# PowerShell path could cause version conflicts.
|
|
56
|
+
system_root = ENV.fetch("SystemRoot", 'C:\Windows')
|
|
57
|
+
[
|
|
58
|
+
"#{system_root}\\System32",
|
|
59
|
+
system_root,
|
|
60
|
+
"#{system_root}\\System32\\Wbem",
|
|
61
|
+
]
|
|
62
|
+
else
|
|
63
|
+
%w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}
|
|
64
|
+
end
|
|
47
65
|
end
|
|
48
66
|
|
|
49
67
|
def __ruby_bindir
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# See the License for the specific language governing permissions and
|
|
16
16
|
# limitations under the License.
|
|
17
17
|
|
|
18
|
-
require "stringio" unless defined?(StringIO)
|
|
19
18
|
require_relative "../internal"
|
|
20
19
|
|
|
21
20
|
module ChefUtils
|
|
@@ -54,6 +53,8 @@ module ChefUtils
|
|
|
54
53
|
#
|
|
55
54
|
def file_open(*args, &block)
|
|
56
55
|
if __transport_connection
|
|
56
|
+
require "stringio" unless defined?(StringIO)
|
|
57
|
+
|
|
57
58
|
content = __transport_connection.file(args[0]).content
|
|
58
59
|
string_io = StringIO.new content
|
|
59
60
|
yield string_io if block_given?
|
data/lib/chef-utils/version.rb
CHANGED
|
@@ -59,28 +59,44 @@ RSpec.describe ChefUtils::DSL::DefaultPaths do
|
|
|
59
59
|
context "on windows" do
|
|
60
60
|
before do
|
|
61
61
|
allow(ChefUtils).to receive(:windows?).and_return(true)
|
|
62
|
+
# Simulate SystemRoot as set by Windows itself (always present)
|
|
63
|
+
stub_const("ENV", ENV.to_hash.merge("SystemRoot" => 'C:\Windows'))
|
|
62
64
|
end
|
|
63
65
|
|
|
64
66
|
let(:test_instance) { DefaultPathsTestClass.new }
|
|
65
67
|
|
|
68
|
+
# Chef 19 (Habitat-based) strips Windows system dirs from PATH; they must be restored.
|
|
69
|
+
let(:win_sys_dirs) { 'C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem' }
|
|
70
|
+
|
|
66
71
|
it "works with no path" do
|
|
67
72
|
env = {}
|
|
68
|
-
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]}")
|
|
73
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]};#{win_sys_dirs}")
|
|
69
74
|
end
|
|
70
75
|
|
|
71
76
|
it "works with nil path" do
|
|
72
77
|
env = { "PATH" => nil }
|
|
73
|
-
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]}")
|
|
78
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]};#{win_sys_dirs}")
|
|
74
79
|
end
|
|
75
80
|
|
|
76
81
|
it "works with empty path" do
|
|
77
82
|
env = { "PATH" => "" }
|
|
78
|
-
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]}")
|
|
83
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]};#{win_sys_dirs}")
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it "prepends gem/ruby bindirs and appends missing system dirs to an existing path" do
|
|
87
|
+
# Simulate a realistic Habitat-stripped PATH that already has System32
|
|
88
|
+
env = { "PATH" => 'C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\\' }
|
|
89
|
+
expect(test_instance.default_paths(env)).to eql(
|
|
90
|
+
"#{Gem.bindir};#{RbConfig::CONFIG["bindir"]};C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\"
|
|
91
|
+
)
|
|
79
92
|
end
|
|
80
93
|
|
|
81
|
-
it "
|
|
82
|
-
env = { "PATH" => "
|
|
83
|
-
|
|
94
|
+
it "does not duplicate system dirs already present in PATH" do
|
|
95
|
+
env = { "PATH" => "#{Gem.bindir};C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\Wbem" }
|
|
96
|
+
path_entries = test_instance.default_paths(env).split(";")
|
|
97
|
+
expect(path_entries.count('C:\Windows\System32')).to eq(1)
|
|
98
|
+
expect(path_entries.count('C:\Windows')).to eq(1)
|
|
99
|
+
expect(path_entries.count('C:\Windows\System32\Wbem')).to eq(1)
|
|
84
100
|
end
|
|
85
101
|
end
|
|
86
102
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chef-utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 19.
|
|
4
|
+
version: 19.4.46
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chef Software, Inc
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 1.3.7
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 1.3.7
|
|
26
26
|
email:
|
|
27
27
|
- oss@chef.io
|
|
28
28
|
executables: []
|