chef-utils 18.4.12 → 18.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef-utils/dsl/virtualization.rb +11 -0
- data/lib/chef-utils/dsl/which.rb +6 -4
- data/lib/chef-utils/version.rb +1 -1
- data/spec/unit/dsl/virtualization_spec.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32f547faa9cdd5fb30e60f1f41fbe6fd45b441c05b0b56d0e2026204e2e03dd4
|
4
|
+
data.tar.gz: 89ef938726a0a01efd5c5daa48bdfd81b15c4500b64a4399b934a14b08648c83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d34f61b5cfd1aeea45b6f6366164678a6b1a2b7191de13b72eff36063c2ddcf2d4e8c032e3c8c89b1f0c9800641841898e1ecf3a6985f06ce988fb7d77cd654
|
7
|
+
data.tar.gz: 9e36b240540dbb096d7097d6a5eb7a2b0d58b7bc98619a438cd4fc15ea39c6d6f2899d216aeaa926b91a9b240ac5d7d739765779207822836917e93a3779900d
|
@@ -184,6 +184,17 @@ module ChefUtils
|
|
184
184
|
node.dig("virtualization", "system") == "openvz" && node.dig("virtualization", "role") == "host"
|
185
185
|
end
|
186
186
|
|
187
|
+
# Determine if the current node is running under Microsoft Hyper-v.
|
188
|
+
#
|
189
|
+
# @param [Chef::Node] node
|
190
|
+
# @since 18.5
|
191
|
+
#
|
192
|
+
# @return [Boolean]
|
193
|
+
#
|
194
|
+
def hyperv?(node = __getnode)
|
195
|
+
node.dig("virtualization", "system") == "hyperv" && node.dig("virtualization", "role") == "guest"
|
196
|
+
end
|
197
|
+
|
187
198
|
# Determine if the current node is running under any virtualization environment
|
188
199
|
#
|
189
200
|
# @param [Chef::Node] node
|
data/lib/chef-utils/dsl/which.rb
CHANGED
@@ -46,11 +46,12 @@ module ChefUtils
|
|
46
46
|
# end
|
47
47
|
#
|
48
48
|
# @param [Array<String>] list of commands to search for
|
49
|
+
# @param [String,Array<String>] array of paths to look in first
|
49
50
|
# @param [String,Array<String>] array of extra paths to search through
|
50
51
|
# @return [String] the first match
|
51
52
|
#
|
52
|
-
def which(*cmds, extra_path: nil, &block)
|
53
|
-
where(*cmds, extra_path: extra_path, &block).first || false
|
53
|
+
def which(*cmds, prepend_path: nil, extra_path: nil, &block)
|
54
|
+
where(*cmds, prepend_path: prepend_path, extra_path: extra_path, &block).first || false
|
54
55
|
end
|
55
56
|
|
56
57
|
# Lookup all the instances of an an executable that can be found through the systems search PATH.
|
@@ -73,12 +74,13 @@ module ChefUtils
|
|
73
74
|
# end
|
74
75
|
#
|
75
76
|
# @param [Array<String>] list of commands to search for
|
77
|
+
# @param [String,Array<String>] array of paths to look in first
|
76
78
|
# @param [String,Array<String>] array of extra paths to search through
|
77
79
|
# @return [String] the first match
|
78
80
|
#
|
79
|
-
def where(*cmds, extra_path: nil, &block)
|
81
|
+
def where(*cmds, prepend_path: nil, extra_path: nil, &block)
|
80
82
|
extra_path ||= __extra_path
|
81
|
-
paths = __env_path.split(File::PATH_SEPARATOR) + Array(extra_path)
|
83
|
+
paths = Array(prepend_path) + __env_path.split(File::PATH_SEPARATOR) + Array(extra_path)
|
82
84
|
paths.uniq!
|
83
85
|
exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : []
|
84
86
|
exts.unshift("")
|
data/lib/chef-utils/version.rb
CHANGED
@@ -45,6 +45,9 @@ RSpec.describe ChefUtils::DSL::Virtualization do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
context "on hyperv" do
|
49
|
+
virtualization_reports_true_for(:guest?, :virtual?, :hyperv?, node: { "virtualization" => { "system" => "hyperv", "role" => "guest" } })
|
50
|
+
end
|
48
51
|
context "on kvm" do
|
49
52
|
virtualization_reports_true_for(:guest?, :virtual?, :kvm?, node: { "virtualization" => { "system" => "kvm", "role" => "guest" } })
|
50
53
|
virtualization_reports_true_for(:hypervisor?, :physical?, :kvm_host?, node: { "virtualization" => { "system" => "kvm", "role" => "host" } })
|
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: 18.
|
4
|
+
version: 18.6.2
|
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: 2024-
|
11
|
+
date: 2024-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|