GitLab upgraded to 13.8.1-ee.0 - changelog: https://gitlab.com/gitlab-org/gitlab/blob/master/CHANGELOG-EE.md

Commit 5203dd3b authored by Eammon Hanlon's avatar Eammon Hanlon Committed by Tim Smith

Add support for Parallels Desktop in Chef::Sugar::Virtualization (#168)

* Add parallels? method to Virtualization

* Add unit tests for parallels?

* Add `parallels?` to README

* Extend module with module_function

* Cookstyle lint: remove ';' ending for methods in Virtualization

* Add parallels? to virtual?
Signed-off-by: default avatarEammon Hanlon <eammon.hanlon@microsoft.com>

* Revert "Extend module with module_function"

This reverts commit a8e3e94ea418862cfbf31717a31e1bebaadb204e.
parent 05af48be
......@@ -471,6 +471,7 @@ end
- `kvm?`
- `lxc?`
- `parallels?`
- `virtualbox?`
- `vmware?`
- `openvz?`
......
......@@ -45,6 +45,19 @@ class Chef
node.key?('virtualization') && node['virtualization']['system'] == 'lxc'
end
#
# Determine if the current node is running under Parallels Desktop.
#
# @param [Chef::Node] node
#
# @return [Boolean]
# true if the machine is currently running under Parallels Desktop, false
# otherwise
#
def parallels?(node)
node.key?('virtualization') && node['virtualization']['system'] == 'Parallels'
end
#
# Determine if the current node is running under VirtualBox.
#
......@@ -85,7 +98,7 @@ class Chef
end
def virtual?(node)
openvz?(node) || vmware?(node) || virtualbox?(node) || lxc?(node) || kvm?(node)
openvz?(node) || vmware?(node) || virtualbox?(node) || parallels?(node) || lxc?(node) || kvm?(node)
end
def physical?(node)
......@@ -95,25 +108,44 @@ class Chef
module DSL
# @see Chef::Sugar::Virtualization#kvm?
def kvm?; Chef::Sugar::Virtualization.kvm?(node); end
def kvm?
Chef::Sugar::Virtualization.kvm?(node)
end
# @see Chef::Sugar::Virtualization#lxc?
def lxc?; Chef::Sugar::Virtualization.lxc?(node); end
def lxc?
Chef::Sugar::Virtualization.lxc?(node)
end
# @see Chef::Sugar::Virtualization#parallels?
def parallels?
Chef::Sugar::Virtualization.parallels?(node)
end
# @see Chef::Sugar::Virtualization#virtualbox?
def virtualbox?; Chef::Sugar::Virtualization.virtualbox?(node); end
def virtualbox?
Chef::Sugar::Virtualization.virtualbox?(node)
end
# @see Chef::Sugar::Virtualization#vmware?
def vmware?; Chef::Sugar::Virtualization.vmware?(node); end
def vmware?
Chef::Sugar::Virtualization.vmware?(node)
end
# @see Chef::Sugar::Virtualization#openvz?
def openvz?; Chef::Sugar::Virtualization.openvz?(node); end
def openvz?
Chef::Sugar::Virtualization.openvz?(node)
end
# @see Chef::Sugar::Virtualization#virtual?
def virtual?; Chef::Sugar::Virtualization.virtual?(node); end
def virtual?
Chef::Sugar::Virtualization.virtual?(node)
end
# @see Chef::Sugar::Virtualization#physical?
def physical?; Chef::Sugar::Virtualization.physical?(node); end
def physical?
Chef::Sugar::Virtualization.physical?(node)
end
end
end
end
......@@ -37,6 +37,23 @@ describe Chef::Sugar::Virtualization do
end
end
describe '#parallels?' do
it 'returns true when the machine is under parallels' do
node = { 'virtualization' => { 'system' => 'Parallels' } }
expect(described_class.parallels?(node)).to be true
end
it 'returns false when the virtual machine is not under parallels' do
node = { 'virtualization' => { 'system' => 'kvm' } }
expect(described_class.parallels?(node)).to be false
end
it 'returns false when the machine is not virtual' do
node = {}
expect(described_class.parallels?(node)).to be false
end
end
describe '#virtualbox?' do
it 'returns true when the machine is under virtualbox' do
node = { 'virtualization' => { 'system' => 'vbox' } }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment