chef-utils 18.4.2 → 18.5.0
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/backend.rb +27 -0
- data/lib/chef-utils/dsl/virtualization.rb +11 -0
- data/lib/chef-utils/version.rb +1 -1
- data/lib/chef-utils.rb +1 -0
- data/spec/unit/dsl/virtualization_spec.rb +3 -0
- 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: b5fbc9f10e67a0acc6882c5a6ba2b4ae3383ea6b7e5325854f35d133c3996c08
|
4
|
+
data.tar.gz: 0d9c0f4499f85cd1a437a0014bad4d54823fd056e8c4f9a1190c41322f67f99b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dd0f5d896dccfbe03b1872f5d2fda08488c8075cf5d67741c507718363901561d355126e354a94c6aab68da348975136caa37ee61f36c84ab04b96645d9ab91
|
7
|
+
data.tar.gz: 4c9fdebb503b72cf3df827184ccb0c038e6e6ade38d94853fa4542b261b51796359c78a03f02f68bb8f5083f567abb8313c72a3edc5838628b0b1a1887b15fd3
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module ChefUtils
|
2
|
+
module DSL
|
3
|
+
module Backend
|
4
|
+
include Internal
|
5
|
+
|
6
|
+
# Determine if the backend is local
|
7
|
+
#
|
8
|
+
# @param [Chef::Node] node the node to check
|
9
|
+
#
|
10
|
+
# @return [Boolean]
|
11
|
+
#
|
12
|
+
def local_mode?
|
13
|
+
node["platform_backend"] == "local"
|
14
|
+
end
|
15
|
+
|
16
|
+
# Determine if the backend is remote
|
17
|
+
#
|
18
|
+
# @param [Chef::Node] node the node to check
|
19
|
+
#
|
20
|
+
# @return [Boolean]
|
21
|
+
#
|
22
|
+
def target_mode?
|
23
|
+
node["platform_backend"] != "local"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -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/version.rb
CHANGED
data/lib/chef-utils.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.5.0
|
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-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- lib/chef-utils.rb
|
38
38
|
- lib/chef-utils/dist.rb
|
39
39
|
- lib/chef-utils/dsl/architecture.rb
|
40
|
+
- lib/chef-utils/dsl/backend.rb
|
40
41
|
- lib/chef-utils/dsl/cloud.rb
|
41
42
|
- lib/chef-utils/dsl/default_paths.rb
|
42
43
|
- lib/chef-utils/dsl/introspection.rb
|