summaryrefslogtreecommitdiff
path: root/chef-utils
diff options
context:
space:
mode:
authorThomas Heinen <theinen@tecracer.de>2021-12-09 13:32:25 +0100
committerThomas Heinen <theinen@tecracer.de>2021-12-09 13:32:25 +0100
commit09aed759c608b0e3e0994f0406124d5a6a6e354a (patch)
treedb705b60d5a332c2abfe5fd1d372115d4ee444eb /chef-utils
parentb03e994746d6125a2d834ef042665f868c3fcdf8 (diff)
downloadchef-09aed759c608b0e3e0994f0406124d5a6a6e354a.tar.gz
Add helpers to detect VMware desktop vs server platforms
Signed-off-by: Thomas Heinen <theinen@tecracer.de>
Diffstat (limited to 'chef-utils')
-rw-r--r--chef-utils/lib/chef-utils/dsl/virtualization.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/chef-utils/lib/chef-utils/dsl/virtualization.rb b/chef-utils/lib/chef-utils/dsl/virtualization.rb
index d2c1c5b531..6271c8a804 100644
--- a/chef-utils/lib/chef-utils/dsl/virtualization.rb
+++ b/chef-utils/lib/chef-utils/dsl/virtualization.rb
@@ -140,6 +140,26 @@ module ChefUtils
node.dig("virtualization", "system") == "vmware" && node.dig("virtualization", "role") == "host"
end
+ # Determine if the current node is virtualized on VMware Desktop (Fusion/Player/Workstation).
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def vmware_desktop?(node = __getnode)
+ node.dig("virtualization", "system") == "vmware" && node.dig("vmware", "host", "type") == "vmware_desktop"
+ end
+
+ # Determine if the current node is virtualized on VMware vSphere (ESX).
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [Boolean]
+ #
+ def vmware_vsphere?(node = __getnode)
+ node.dig("virtualization", "system") == "vmware" && node.dig("vmware", "host", "type") == "vmware_vsphere"
+ end
+
# Determine if the current node is an openvz guest.
#
# @param [Chef::Node] node