chef-utils 16.1.0 → 16.3.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/chef-utils.gemspec +1 -2
- data/lib/chef-utils.rb +2 -1
- data/lib/chef-utils/dsl/architecture.rb +3 -3
- data/lib/chef-utils/dsl/default_paths.rb +59 -0
- data/lib/chef-utils/dsl/path_sanity.rb +6 -27
- data/lib/chef-utils/dsl/platform_family.rb +1 -1
- data/lib/chef-utils/dsl/service.rb +3 -2
- data/lib/chef-utils/dsl/which.rb +4 -4
- data/lib/chef-utils/internal.rb +40 -4
- data/lib/chef-utils/version.rb +2 -2
- data/lib/chef-utils/version_string.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/dsl/architecture_spec.rb +11 -0
- data/spec/unit/dsl/introspection_spec.rb +2 -1
- data/spec/unit/dsl/path_sanity_spec.rb +14 -14
- data/spec/unit/dsl/platform_family_spec.rb +1 -1
- data/spec/unit/dsl/platform_spec.rb +3 -0
- data/spec/unit/dsl/which_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f5b96fe6160526b332bbb97dd82753a024e239478257753052287f5a91b2239
|
4
|
+
data.tar.gz: 5b8504937acdb70a72818d139c60eb760da04be5c8238b172a9c76a02b945bda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfd59cb093364785edc3ddb3261f792c9d13a6e63cfbf2ef3abaee879a020fcbcf913d47b4a93f6bcb59b77887638cad5342bd93db8bea625d087bfaf2e6afcf
|
7
|
+
data.tar.gz: 36faef376d1e3439bcfb743c48aea0b19e466461ee238706429058f11eabcfdf76ebdcf3d396867fe349c5beb78f0853e209e35f5c76a854cd9ff50075ca246a
|
data/chef-utils.gemspec
CHANGED
data/lib/chef-utils.rb
CHANGED
@@ -19,6 +19,7 @@ require_relative "chef-utils/dsl/architecture"
|
|
19
19
|
require_relative "chef-utils/dsl/cloud"
|
20
20
|
require_relative "chef-utils/dsl/introspection"
|
21
21
|
require_relative "chef-utils/dsl/os"
|
22
|
+
require_relative "chef-utils/dsl/default_paths"
|
22
23
|
require_relative "chef-utils/dsl/path_sanity"
|
23
24
|
require_relative "chef-utils/dsl/platform"
|
24
25
|
require_relative "chef-utils/dsl/platform_family"
|
@@ -34,9 +35,9 @@ require_relative "chef-utils/mash"
|
|
34
35
|
module ChefUtils
|
35
36
|
include ChefUtils::DSL::Architecture
|
36
37
|
include ChefUtils::DSL::Cloud
|
38
|
+
include ChefUtils::DSL::DefaultPaths
|
37
39
|
include ChefUtils::DSL::Introspection
|
38
40
|
include ChefUtils::DSL::OS
|
39
|
-
include ChefUtils::DSL::PathSanity
|
40
41
|
include ChefUtils::DSL::Platform
|
41
42
|
include ChefUtils::DSL::PlatformFamily
|
42
43
|
include ChefUtils::DSL::PlatformVersion
|
@@ -110,17 +110,17 @@ module ChefUtils
|
|
110
110
|
# @return [Boolean]
|
111
111
|
#
|
112
112
|
def arm?(node = __getnode)
|
113
|
-
%w{armhf aarch64 arm64 arch64}.include?(node["kernel"]["machine"])
|
113
|
+
%w{armv6l armv7l armhf aarch64 arm64 arch64}.include?(node["kernel"]["machine"])
|
114
114
|
end
|
115
115
|
|
116
|
-
# Determine if the current architecture is 32-bit ARM.
|
116
|
+
# Determine if the current architecture is 32-bit ARM hard float.
|
117
117
|
#
|
118
118
|
# @since 15.5
|
119
119
|
#
|
120
120
|
# @return [Boolean]
|
121
121
|
#
|
122
122
|
def armhf?(node = __getnode)
|
123
|
-
%w{armhf}.include?(node["kernel"]["machine"])
|
123
|
+
%w{armv6l armv7l armhf}.include?(node["kernel"]["machine"])
|
124
124
|
end
|
125
125
|
|
126
126
|
# Determine if the current architecture is s390x.
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#
|
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 "../internal"
|
19
|
+
require_relative "platform_family"
|
20
|
+
|
21
|
+
module ChefUtils
|
22
|
+
module DSL
|
23
|
+
module DefaultPaths
|
24
|
+
include Internal
|
25
|
+
|
26
|
+
# @since 15.5
|
27
|
+
def default_paths(env = nil)
|
28
|
+
env_path = env ? env["PATH"] : __env_path
|
29
|
+
env_path = "" if env_path.nil?
|
30
|
+
path_separator = ChefUtils.windows? ? ";" : ":"
|
31
|
+
# ensure the Ruby and Gem bindirs are included for omnibus chef installs
|
32
|
+
new_paths = env_path.split(path_separator)
|
33
|
+
[ __ruby_bindir, __gem_bindir ].compact.each do |path|
|
34
|
+
new_paths = [ path ] + new_paths unless new_paths.include?(path)
|
35
|
+
end
|
36
|
+
__default_paths.each do |path|
|
37
|
+
new_paths << path unless new_paths.include?(path)
|
38
|
+
end
|
39
|
+
new_paths.join(path_separator).encode("utf-8", invalid: :replace, undef: :replace)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def __default_paths
|
45
|
+
ChefUtils.windows? ? %w{} : %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}
|
46
|
+
end
|
47
|
+
|
48
|
+
def __ruby_bindir
|
49
|
+
RbConfig::CONFIG["bindir"]
|
50
|
+
end
|
51
|
+
|
52
|
+
def __gem_bindir
|
53
|
+
Gem.bindir
|
54
|
+
end
|
55
|
+
|
56
|
+
extend self
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -15,42 +15,21 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require_relative "
|
19
|
-
require_relative "platform_family"
|
18
|
+
require_relative "default_paths"
|
20
19
|
|
21
20
|
module ChefUtils
|
22
21
|
module DSL
|
23
22
|
module PathSanity
|
24
|
-
include
|
23
|
+
include ChefUtils::DSL::DefaultPaths
|
25
24
|
|
26
|
-
# @since 15.5
|
27
25
|
def sanitized_path(env = nil)
|
28
|
-
|
29
|
-
env_path = "" if env_path.nil?
|
30
|
-
path_separator = ChefUtils.windows? ? ";" : ":"
|
31
|
-
# ensure the Ruby and Gem bindirs are included for omnibus chef installs
|
32
|
-
new_paths = env_path.split(path_separator)
|
33
|
-
[ ChefUtils::DSL::PathSanity.ruby_bindir, ChefUtils::DSL::PathSanity.gem_bindir ].compact.each do |path|
|
34
|
-
new_paths = [ path ] + new_paths unless new_paths.include?(path)
|
35
|
-
end
|
36
|
-
ChefUtils::DSL::PathSanity.sane_paths.each do |path|
|
37
|
-
new_paths << path unless new_paths.include?(path)
|
38
|
-
end
|
39
|
-
new_paths.join(path_separator).encode("utf-8", invalid: :replace, undef: :replace)
|
26
|
+
default_paths(env)
|
40
27
|
end
|
41
28
|
|
42
|
-
|
43
|
-
def sane_paths
|
44
|
-
ChefUtils.windows? ? %w{} : %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}
|
45
|
-
end
|
29
|
+
private
|
46
30
|
|
47
|
-
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def gem_bindir
|
52
|
-
Gem.bindir
|
53
|
-
end
|
31
|
+
def __sane_paths
|
32
|
+
__default_paths
|
54
33
|
end
|
55
34
|
|
56
35
|
extend self
|
@@ -301,7 +301,7 @@ module ChefUtils
|
|
301
301
|
end
|
302
302
|
|
303
303
|
# RedHat distros -- fedora and rhel platform_families, nothing else. This is most likely not as useful as the
|
304
|
-
# "
|
304
|
+
# "fedora_derived?" helper.
|
305
305
|
#
|
306
306
|
# @param [Chef::Node] node the node to check
|
307
307
|
# @since 15.5
|
@@ -25,6 +25,7 @@ module ChefUtils
|
|
25
25
|
module Service
|
26
26
|
include Internal
|
27
27
|
include TrainHelpers
|
28
|
+
include Introspection
|
28
29
|
|
29
30
|
# Returns if debian's old rc.d manager is installed (not necessarily the primary init system).
|
30
31
|
#
|
@@ -97,8 +98,8 @@ module ChefUtils
|
|
97
98
|
file_exist?("/etc/rc.d/#{script}")
|
98
99
|
when :systemd
|
99
100
|
file_exist?("/etc/init.d/#{script}") ||
|
100
|
-
|
101
|
-
|
101
|
+
has_systemd_service_unit?(script) ||
|
102
|
+
has_systemd_unit?(script)
|
102
103
|
else
|
103
104
|
raise ArgumentError, "type of service must be one of :initd, :upstart, :xinetd, :etc_rcd, or :systemd"
|
104
105
|
end
|
data/lib/chef-utils/dsl/which.rb
CHANGED
@@ -25,7 +25,7 @@ module ChefUtils
|
|
25
25
|
# Lookup an executable through the systems search PATH. Allows specifying an array
|
26
26
|
# of executables to look for. The first executable that is found, along any path entry,
|
27
27
|
# will be the preferred one and returned first. The extra_path will override any default
|
28
|
-
# extra_paths which are added (
|
28
|
+
# extra_paths which are added (allowing the user to pass an empty array to remove them).
|
29
29
|
#
|
30
30
|
# When passed a block the block will be called with the full pathname of any executables
|
31
31
|
# which are found, and the block should return truthy or falsey values to further filter
|
@@ -34,7 +34,7 @@ module ChefUtils
|
|
34
34
|
# This is syntactic sugar for `where(...).first`
|
35
35
|
#
|
36
36
|
# This helper can be used in target mode in chef or with train using the appropriate
|
37
|
-
# wiring
|
37
|
+
# wiring externally.
|
38
38
|
#
|
39
39
|
# @example Find the most appropriate python executable, searching through the system PATH
|
40
40
|
# plus additionally the "/usr/libexec" directory, which has the dnf libraries
|
@@ -55,14 +55,14 @@ module ChefUtils
|
|
55
55
|
# Lookup all the instances of an an executable that can be found through the systems search PATH.
|
56
56
|
# Allows specifying an array of executables to look for. All the instances of the first executable
|
57
57
|
# that is found will be returned first. The extra_path will override any default extra_paths
|
58
|
-
# which are added (
|
58
|
+
# which are added (allowing the user to pass an empty array to remove them).
|
59
59
|
#
|
60
60
|
# When passed a block the block will be called with the full pathname of any executables
|
61
61
|
# which are found, and the block should return truthy or falsey values to further filter
|
62
62
|
# the executable based on arbitrary criteria.
|
63
63
|
#
|
64
64
|
# This helper can be used in target mode in chef or with train using the appropriate
|
65
|
-
# wiring
|
65
|
+
# wiring externally.
|
66
66
|
#
|
67
67
|
# @example Find all the python executables, searching through the system PATH plus additionally
|
68
68
|
# the "/usr/libexec" directory, which have the dnf libraries installed and available.
|
data/lib/chef-utils/internal.rb
CHANGED
@@ -27,7 +27,7 @@ module ChefUtils
|
|
27
27
|
#
|
28
28
|
# This gem may be used by gems like mixlib-shellout which can be consumed by external non-Chef utilities,
|
29
29
|
# so including brittle code here which depends on the existence of the chef-client will cause broken
|
30
|
-
# behavior downstream. You must practice defensive coding, and not make assumptions about
|
30
|
+
# behavior downstream. You must practice defensive coding, and not make assumptions about running within chef-client.
|
31
31
|
#
|
32
32
|
# Other consumers may mix in the helper classes and then override the methods here and provide their own custom
|
33
33
|
# wiring and override what is provided here. They are marked as private because no downstream user should ever touch
|
@@ -40,11 +40,18 @@ module ChefUtils
|
|
40
40
|
|
41
41
|
private
|
42
42
|
|
43
|
-
#
|
44
|
-
#
|
45
|
-
|
43
|
+
# This should be set to a Chef::Node instance or to some Hash/Mash-like configuration object with the same keys. It needs to
|
44
|
+
# expose keys like `:os`, `:platform`, `:platform_version` and `:platform_family` at least to be useful. It will automatically
|
45
|
+
# pick up a `node` method when mixed into an object that has that as a method (which is the encouraged "public" API to use
|
46
|
+
# for dependency injection rather than overriding the method in this case.
|
47
|
+
#
|
48
|
+
# @return [Hash] hash-like config object
|
49
|
+
#
|
46
50
|
# @api private
|
47
51
|
def __getnode(skip_global = false)
|
52
|
+
# Software developers should feel free to rely on the default wiring here to the node method by implementing the node method in their
|
53
|
+
# own class. For anything more complicated they should completely override the method (overriding the whole method is never wrong and
|
54
|
+
# is safer).
|
48
55
|
return node if respond_to?(:node) && node
|
49
56
|
|
50
57
|
return run_context&.node if respond_to?(:run_context) && run_context&.node
|
@@ -56,7 +63,10 @@ module ChefUtils
|
|
56
63
|
nil
|
57
64
|
end
|
58
65
|
|
66
|
+
# Just a helper to pull the ENV["PATH"] in a train-independent way
|
67
|
+
#
|
59
68
|
# @api private
|
69
|
+
#
|
60
70
|
def __env_path
|
61
71
|
if __transport_connection
|
62
72
|
__transport_connection.run_command("echo $PATH").stdout || ""
|
@@ -65,13 +75,39 @@ module ChefUtils
|
|
65
75
|
end
|
66
76
|
end
|
67
77
|
|
78
|
+
# This should be set to a Train::Plugins::Transport instance. You should wire this up to nil for not using a train transport connection.
|
79
|
+
#
|
80
|
+
# @return [Train::Plugins::Transport]
|
81
|
+
#
|
68
82
|
# @api private
|
83
|
+
#
|
69
84
|
def __transport_connection
|
85
|
+
# Software consumers MUST override this method with their own implementation. The default behavior here is subject to change.
|
70
86
|
return Chef.run_context.transport_connection if defined?(Chef) && Chef.respond_to?(:run_context) && Chef&.run_context&.transport_connection
|
71
87
|
|
72
88
|
nil
|
73
89
|
end
|
74
90
|
|
91
|
+
# This should be set to Chef::Config or to some Hash/Mash-like configuration object with the same keys. It must not be nil.
|
92
|
+
#
|
93
|
+
# @return [Hash] hash-like config object
|
94
|
+
#
|
95
|
+
# @api private
|
96
|
+
#
|
97
|
+
def __config
|
98
|
+
raise NotImplementedError
|
99
|
+
end
|
100
|
+
|
101
|
+
# This should be set to Chef::Log or something that duck-types like it. It must not be nil.
|
102
|
+
#
|
103
|
+
# @return [Chef::Log] logger-like logging object
|
104
|
+
#
|
105
|
+
# @api private
|
106
|
+
#
|
107
|
+
def __log
|
108
|
+
raise NotImplementedError
|
109
|
+
end
|
110
|
+
|
75
111
|
extend self
|
76
112
|
end
|
77
113
|
end
|
data/lib/chef-utils/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -131,6 +131,17 @@ RSpec.describe ChefUtils::DSL::Architecture do
|
|
131
131
|
|
132
132
|
arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
|
133
133
|
end
|
134
|
+
context "on armv6l" do
|
135
|
+
let(:arch) { "armv6l" }
|
136
|
+
|
137
|
+
arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
|
138
|
+
end
|
139
|
+
context "on armv7l" do
|
140
|
+
let(:arch) { "armv7l" }
|
141
|
+
|
142
|
+
arch_reports_true_for(:armhf?, :_32_bit?, :arm?)
|
143
|
+
end
|
144
|
+
|
134
145
|
context "on s390" do
|
135
146
|
let(:arch) { "s390" }
|
136
147
|
|
@@ -21,6 +21,7 @@ RSpec.describe ChefUtils::DSL::Introspection do
|
|
21
21
|
class IntrospectionTestClass
|
22
22
|
include ChefUtils::DSL::Introspection
|
23
23
|
attr_accessor :node
|
24
|
+
|
24
25
|
def initialize(node)
|
25
26
|
@node = node
|
26
27
|
end
|
@@ -31,7 +32,7 @@ RSpec.describe ChefUtils::DSL::Introspection do
|
|
31
32
|
let(:test_instance) { IntrospectionTestClass.new(node) }
|
32
33
|
|
33
34
|
context "#docker?" do
|
34
|
-
# FIXME: use a real VividMash for these tests
|
35
|
+
# FIXME: use a real VividMash for these tests instead of stubbing
|
35
36
|
it "is false by default" do
|
36
37
|
expect(node).to receive(:read).with("virtualization", "systems", "docker").and_return(nil)
|
37
38
|
expect(ChefUtils.docker?(node)).to be false
|
@@ -17,9 +17,9 @@
|
|
17
17
|
|
18
18
|
require "spec_helper"
|
19
19
|
|
20
|
-
RSpec.describe ChefUtils::DSL::
|
21
|
-
class
|
22
|
-
include ChefUtils::DSL::
|
20
|
+
RSpec.describe ChefUtils::DSL::DefaultPaths do
|
21
|
+
class DefaultPathsTestClass
|
22
|
+
include ChefUtils::DSL::DefaultPaths
|
23
23
|
end
|
24
24
|
|
25
25
|
before do
|
@@ -32,26 +32,26 @@ RSpec.describe ChefUtils::DSL::PathSanity do
|
|
32
32
|
allow(ChefUtils).to receive(:windows?).and_return(false)
|
33
33
|
end
|
34
34
|
|
35
|
-
let(:test_instance) {
|
35
|
+
let(:test_instance) { DefaultPathsTestClass.new }
|
36
36
|
|
37
37
|
it "works with no path" do
|
38
38
|
env = {}
|
39
|
-
expect(test_instance.
|
39
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir}:#{RbConfig::CONFIG["bindir"]}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
|
40
40
|
end
|
41
41
|
|
42
42
|
it "works with nil path" do
|
43
43
|
env = { "PATH" => nil }
|
44
|
-
expect(test_instance.
|
44
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir}:#{RbConfig::CONFIG["bindir"]}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
|
45
45
|
end
|
46
46
|
|
47
47
|
it "works with empty path" do
|
48
48
|
env = { "PATH" => "" }
|
49
|
-
expect(test_instance.
|
49
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir}:#{RbConfig::CONFIG["bindir"]}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
|
50
50
|
end
|
51
51
|
|
52
|
-
it "appends the
|
52
|
+
it "appends the default_paths to the end of the path, preserving any that already exist, in the same order" do
|
53
53
|
env = { "PATH" => "/bin:/opt/app/bin:/sbin" }
|
54
|
-
expect(test_instance.
|
54
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir}:#{RbConfig::CONFIG["bindir"]}:/bin:/opt/app/bin:/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin")
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -60,26 +60,26 @@ RSpec.describe ChefUtils::DSL::PathSanity do
|
|
60
60
|
allow(ChefUtils).to receive(:windows?).and_return(true)
|
61
61
|
end
|
62
62
|
|
63
|
-
let(:test_instance) {
|
63
|
+
let(:test_instance) { DefaultPathsTestClass.new }
|
64
64
|
|
65
65
|
it "works with no path" do
|
66
66
|
env = {}
|
67
|
-
expect(test_instance.
|
67
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]}")
|
68
68
|
end
|
69
69
|
|
70
70
|
it "works with nil path" do
|
71
71
|
env = { "PATH" => nil }
|
72
|
-
expect(test_instance.
|
72
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]}")
|
73
73
|
end
|
74
74
|
|
75
75
|
it "works with empty path" do
|
76
76
|
env = { "PATH" => "" }
|
77
|
-
expect(test_instance.
|
77
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]}")
|
78
78
|
end
|
79
79
|
|
80
80
|
it "prepends to an existing path" do
|
81
81
|
env = { "PATH" => '%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\\' }
|
82
|
-
expect(test_instance.
|
82
|
+
expect(test_instance.default_paths(env)).to eql("#{Gem.bindir};#{RbConfig::CONFIG["bindir"]};%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\")
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -209,7 +209,7 @@ RSpec.describe ChefUtils::DSL::PlatformFamily do
|
|
209
209
|
end
|
210
210
|
|
211
211
|
context "node-independent windows APIs" do
|
212
|
-
if RUBY_PLATFORM
|
212
|
+
if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
|
213
213
|
it "reports true for :windows_ruby?" do
|
214
214
|
expect(described_class.windows_ruby?).to be true
|
215
215
|
end
|
@@ -58,6 +58,7 @@ RSpec.describe ChefUtils::DSL::Platform do
|
|
58
58
|
class ThingWithANode
|
59
59
|
include ChefUtils::DSL::Platform
|
60
60
|
attr_accessor :node
|
61
|
+
|
61
62
|
def initialize(node)
|
62
63
|
@node = node
|
63
64
|
end
|
@@ -69,6 +70,7 @@ RSpec.describe ChefUtils::DSL::Platform do
|
|
69
70
|
attr_accessor :node
|
70
71
|
end
|
71
72
|
attr_accessor :run_context
|
73
|
+
|
72
74
|
def initialize(node)
|
73
75
|
@run_context = RunContext.new
|
74
76
|
run_context.node = node
|
@@ -78,6 +80,7 @@ RSpec.describe ChefUtils::DSL::Platform do
|
|
78
80
|
class ThingWithTheDSL
|
79
81
|
include ChefUtils
|
80
82
|
attr_accessor :node
|
83
|
+
|
81
84
|
def initialize(node)
|
82
85
|
@node = node
|
83
86
|
end
|
data/spec/unit/dsl/which_spec.rb
CHANGED
@@ -78,7 +78,7 @@ RSpec.describe ChefUtils::DSL::Which do
|
|
78
78
|
end
|
79
79
|
|
80
80
|
context "with a block" do
|
81
|
-
test_which("
|
81
|
+
test_which("doesn't find it if its false", "foo1", others: [ "/dir1/foo1" ]) do |f|
|
82
82
|
false
|
83
83
|
end
|
84
84
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 16.
|
4
|
+
version: 16.3.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -23,6 +23,7 @@ files:
|
|
23
23
|
- lib/chef-utils.rb
|
24
24
|
- lib/chef-utils/dsl/architecture.rb
|
25
25
|
- lib/chef-utils/dsl/cloud.rb
|
26
|
+
- lib/chef-utils/dsl/default_paths.rb
|
26
27
|
- lib/chef-utils/dsl/introspection.rb
|
27
28
|
- lib/chef-utils/dsl/os.rb
|
28
29
|
- lib/chef-utils/dsl/path_sanity.rb
|