Files
puppet-openstacklib/manifests/db/postgresql.pp
Gael Chamoulaud cba7bf6fa8 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>
2015-03-31 11:54:59 +02:00

47 lines
1.4 KiB
Puppet

# == Definition: openstacklib::db::postgresql
#
# This resource configures a postgresql database for an OpenStack service
#
# == Parameters:
#
# [*password_hash*]
# Password hash to use for the database user for this service;
# string; required
#
# [*dbname*]
# The name of the database
# string; optional; default to the $title of the resource, i.e. 'nova'
#
# [*user*]
# The database user to create;
# string; optional; default to the $title of the resource, i.e. 'nova'
#
# [*encoding*]
# The charset to use for the database;
# string; optional; default to undef
#
# [*privileges*]
# Privileges given to the database user;
# string or array of strings; optional; default to 'ALL'
define openstacklib::db::postgresql (
$password_hash,
$dbname = $title,
$user = $title,
$encoding = undef,
$privileges = 'ALL',
){
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.')
}
postgresql::server::db { $dbname:
user => $user,
password => $password_hash,
encoding => $encoding,
grant => $privileges,
}
}