2114333539
This adds the parameter 'locale' to the 'postgresql' class so we have a global default, and adds it two the defined resources 'postgresql::db' and 'postgresql::database'. This allows users to either: * Defined a global default for the cluster * Define a per-database default As a side-effect I had to make sure 'charset' was also exposed in a similar manner as some locales need a particular charset to work. Tests were added to test both the 'createdb' case and 'initdb' case for Redhat, and some refactoring was done to make the existing non_default test area use heredocs so my manifests and test code was kept close together. As apposed to entirely different files and places in the directory structure. I cleaned up the related execs a little bit, adding logoutput => on_failure where needed so we can debug failures. Beforehand execs just 'failed', but now we should be able to get better feedback from failed execs helping support. I also add intention comments in parts of the Puppet code that I touched where it made sense. Signed-off-by: Ken Barber <ken@bob.sh>
50 lines
2.1 KiB
Puppet
50 lines
2.1 KiB
Puppet
# Class: postgresql
|
|
#
|
|
# This is a base class that can be used to modify catalog-wide settings relating
|
|
# to the various types in class contained in the postgresql module.
|
|
#
|
|
# If you don't declare this class in your catalog, sensible defaults will
|
|
# be used. However, if you choose to declare it, it needs to appear *before*
|
|
# any other types or classes from the postgresql module.
|
|
#
|
|
# For examples, see the files in the `tests` directory; in particular,
|
|
# `/server-yum-postgresql-org.pp`.
|
|
#
|
|
# Parameters:
|
|
# [*version*] - The postgresql version to install. If not specified, the
|
|
# module will use whatever version is the default for your
|
|
# OS distro.
|
|
# [*manage_package_repo*] - This determines whether or not the module should
|
|
# attempt to manage the postgres package repository for your
|
|
# distro. Defaults to `false`, but if set to `true`, it can
|
|
# be used to set up the official postgres yum/apt package
|
|
# repositories for you.
|
|
# [*package_source*] - This setting is only used if `manage_package_repo` is
|
|
# set to `true`. It determines which package repository should
|
|
# be used to install the postgres packages. Currently supported
|
|
# values include `yum.postgresql.org`.
|
|
# [*locale*] - This setting defines the default locale for initdb and createdb
|
|
# commands. This default to 'undef' which is effectively 'C'.
|
|
# [*charset*] - Sets the default charset to be used for initdb and createdb.
|
|
# Defaults to 'UTF8'.
|
|
# Actions:
|
|
#
|
|
# Requires:
|
|
#
|
|
# Sample Usage:
|
|
#
|
|
class postgresql (
|
|
$version = $::postgres_default_version,
|
|
$manage_package_repo = false,
|
|
$package_source = undef,
|
|
$locale = undef,
|
|
$charset = 'UTF8'
|
|
) {
|
|
class { 'postgresql::params':
|
|
version => $version,
|
|
manage_package_repo => $manage_package_repo,
|
|
package_source => $package_source,
|
|
locale => $locale,
|
|
charset => $charset,
|
|
}
|
|
}
|