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: Ic66516a5548be0fe6f6fb818d04086cf234f2fc1
Closes-bug: 1425300
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud
2015-03-31 11:54:23 +02:00
parent efa9181201
commit cba7bf6fa8

View File

@@ -32,8 +32,8 @@ define openstacklib::db::postgresql (
$privileges = 'ALL',
){
if ((($::operatingsystem == 'RedHat' or $::operatingsystem == 'CentOS') and $::operatingsystemmajrelease <= 6)
or ($::operatingsystem == 'Fedora' and $::operatingsystemmajrelease <= 14)) {
if ((($::operatingsystem == 'RedHat' or $::operatingsystem == 'CentOS') and (versioncmp($::operatingsystemmajrelease, '6') <= 0))
or ($::operatingsystem == 'Fedora' and (versioncmp($::operatingsystemmajrelease, '14') <= 0))) {
warning('The system packages handling the postgresql infrastructure for OpenStack are out of date and should not be relied on for database migrations.')
}