-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
Previously it (ab)used Hiera to set the supported versions. This now uses metadata.json and facts to do the same. The parameter is kept in to override this. It is turned into undef to allow pick() and signal that the value is determined later.
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
--- | ||
|
||
openvmtools::manage_epel: true | ||
openvmtools::supported: true |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
--- | ||
|
||
openvmtools::manage_epel: true | ||
openvmtools::supported: true |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
--- | ||
|
||
openvmtools::manage_epel: true | ||
openvmtools::supported: true |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# @summary Returns whether the currently loaded OS is supported by the module | ||
# | ||
# This function uses the current facts to check if the current Operating System | ||
# and its release or major release is supported. | ||
# | ||
# @param mod | ||
# The module name to check. | ||
# | ||
# @example Using the Puppet built in global $module_name | ||
# openvmtools::supported($module_name) | ||
function openvmtools::supported(String[1] $mod) >> Boolean { | ||
$metadata = load_module_metadata($mod) | ||
unless $metadata { | ||
fail("Unable to load metadata for mod '${mod}'") | ||
} | ||
$metadata['operatingsystem_support'].any |$os| { | ||
$os['operatingsystem'] == $facts['os']['name'] and $facts['os']['release']['major'] in $os['operatingsystemrelease'] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'spec_helper' | ||
|
||
describe 'openvmtools::supported' do | ||
context 'On Debian 10' do | ||
let(:facts) do | ||
{ | ||
operatingsystem: 'Debian', | ||
operatingsystemmajrelease: '10', | ||
} | ||
end | ||
|
||
it 'returns true' do | ||
is_expected.to run.with_params('openvmtools').and_return(true) | ||
end | ||
end | ||
end |