puppet-murano/manifests/db/postgresql_cfapi.pp
Tobias Urdin 52f9b4c5f7 Use validate_legacy
This changes all the puppet 3 validate_* functions
to use the validate_legacy function.

The validate_legacy function has been available since
about three years but require Puppet >= 4.4.0 and since
there is Puppet 4.10.12 as latest we should assume people
are running a fairly new Puppet 4 version.

This is the first step to then remove all validate function
calls and use proper types for parameter as described in spec [1].

[1] https://review.openstack.org/#/c/568929/

Change-Id: I4da049ff59fd71403f4d00cfad8c5f56041e1e6e
2019-02-23 23:23:09 +01:00

52 lines
1.2 KiB
Puppet

# == Class: murano::db::postgresql_cfapi
#
# The murano::db::postgresql_cfapi creates a PostgreSQL database for murano_cfapi.
# It must be used on the PostgreSQL server.
#
# === Parameters
#
# [*password*]
# (Required) Password to connect to the database.
#
# [*dbname*]
# (Optional) Name of the database.
# Defaults to 'murano_cfapi'.
#
# [*user*]
# (Optional) User to connect to the database.
# Defaults to 'murano_cfapi'.
#
# [*encoding*]
# (Optional) The charset to use for the database.
# Default to undef.
#
# [*privileges*]
# (Optional) Privileges given to the database user.
# Default to 'ALL'
#
class murano::db::postgresql_cfapi(
$password,
$dbname = 'murano_cfapi',
$user = 'murano_cfapi',
$encoding = undef,
$privileges = 'ALL',
) {
include ::murano::deps
validate_legacy(String, 'validate_string', $password)
::openstacklib::db::postgresql { 'murano_cfapi':
password_hash => postgresql_password($user, $password),
dbname => $dbname,
user => $user,
encoding => $encoding,
privileges => $privileges,
}
Anchor['murano::db::begin']
~> Class['murano::db::postgresql_cfapi']
~> Anchor['murano::db::end']
}