Use versioncmp for '::operatingsystemmajrelease' comparison
Use the builtin versioncmp() function for comparisons of the '::operatingsystemmajrelease' fact. If that fact evaluates to a string, regular arithmetric comparisons will fail under the Puppet 4.x language. Change-Id: Ib55dabd3c33f5773ac3ca67955e0f85418ec0698 Closes-bug: 1425300 Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
parent
77e1c46656
commit
5a02533d7c
@ -43,7 +43,7 @@ class cinder::params {
|
||||
|
||||
case $::operatingsystem {
|
||||
'RedHat', 'CentOS', 'Scientific': {
|
||||
if $::operatingsystemmajrelease >= 7 {
|
||||
if (versioncmp($::operatingsystemmajrelease, '7') >= 0) {
|
||||
$iscsi_helper = 'lioadm'
|
||||
} else {
|
||||
$iscsi_helper = 'tgtadm'
|
||||
|
@ -43,7 +43,7 @@ describe 'cinder::volume::iscsi' do
|
||||
it_raises 'a Puppet::Error', /Unsupported iscsi helper: fooboozoo/
|
||||
end
|
||||
|
||||
describe 'with RedHat' do
|
||||
describe 'on RHEL Platforms' do
|
||||
|
||||
let :params do
|
||||
req_params
|
||||
@ -52,6 +52,7 @@ describe 'cinder::volume::iscsi' do
|
||||
let :facts do
|
||||
{:osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:operatingsystemrelease => 6.5,
|
||||
:operatingsystemmajrelease => '6'}
|
||||
end
|
||||
|
||||
@ -66,12 +67,15 @@ describe 'cinder::volume::iscsi' do
|
||||
|
||||
let :params do {
|
||||
:iscsi_ip_address => '127.0.0.2',
|
||||
:iscsi_helper => 'lioadm'
|
||||
:iscsi_helper => 'lioadm'
|
||||
}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{:osfamily => 'RedHat'}
|
||||
{:osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:operatingsystemrelease => 7.0,
|
||||
:operatingsystemmajrelease => '7'}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('targetcli').with_ensure('present')}
|
||||
|
Loading…
x
Reference in New Issue
Block a user