Use versioncmp for ::operatingsystemmajrelease comparison
Use the stdlib 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: I021fd79c2f10244c9e47284a1d5b7ca331593fc0 Closes-bug: 1425300
This commit is contained in:
parent
d1a2f9606d
commit
a0d934b6e2
@ -48,7 +48,7 @@ class nova::params {
|
||||
$special_service_provider = undef
|
||||
}
|
||||
'RedHat', 'CentOS', 'Scientific': {
|
||||
if ($::operatingsystemmajrelease < 7) {
|
||||
if (versioncmp($::operatingsystemmajrelease, '7') < 0) {
|
||||
$special_service_provider = 'init'
|
||||
} else {
|
||||
$special_service_provider = undef
|
||||
|
@ -129,7 +129,8 @@ describe 'nova::compute::libvirt' do
|
||||
describe 'on rhel platforms' do
|
||||
let :facts do
|
||||
{ :operatingsystem => 'RedHat', :osfamily => 'RedHat',
|
||||
:operatingsystemrelease => 6.5 }
|
||||
:operatingsystemrelease => 6.5,
|
||||
:operatingsystemmajrelease => '6' }
|
||||
end
|
||||
|
||||
describe 'with default parameters' do
|
||||
@ -145,7 +146,7 @@ describe 'nova::compute::libvirt' do
|
||||
:name => 'libvirtd',
|
||||
:enable => true,
|
||||
:ensure => 'running',
|
||||
:provider => nil,
|
||||
:provider => 'init',
|
||||
:require => 'Package[libvirt]',
|
||||
:before => 'Service[nova-compute]'
|
||||
)}
|
||||
@ -153,12 +154,13 @@ describe 'nova::compute::libvirt' do
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:before => 'Service[libvirt]',
|
||||
:provider => nil
|
||||
:provider => 'init'
|
||||
) }
|
||||
|
||||
describe 'on rhel 7' do
|
||||
let :facts do
|
||||
super().merge(:operatingsystemrelease => 7.0)
|
||||
super().merge(:operatingsystemmajrelease => '7')
|
||||
end
|
||||
|
||||
it { is_expected.to contain_service('libvirt').with(
|
||||
|
Loading…
x
Reference in New Issue
Block a user