Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use variable for postgresql locale #422

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion manifests/database/postgresql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#
# @param postgresql_ssl_ca_cert_path
# Path to the Postgresql SSL CA.
# @param postgresql_locale
# The locale to use for the database. Defaults to `C.UTF-8`.
#
# @param read_database_username
# The name of the read database user to connect as. Defaults to `puppetdb-read`. This
Expand Down Expand Up @@ -85,6 +87,7 @@
$postgresql_ssl_key_path = $puppetdb::params::postgresql_ssl_key_path,
$postgresql_ssl_cert_path = $puppetdb::params::postgresql_ssl_cert_path,
$postgresql_ssl_ca_cert_path = $puppetdb::params::postgresql_ssl_ca_cert_path,
$postgresql_locale = $puppetdb::params::postgresql_locale,
$read_database_username = $puppetdb::params::read_database_username,
Variant[String[1], Sensitive[String[1]]] $read_database_password = $puppetdb::params::read_database_password,
$read_database_host = $puppetdb::params::read_database_host,
Expand Down Expand Up @@ -150,7 +153,7 @@
user => $database_username,
password => $database_password,
encoding => 'UTF8',
locale => 'en_US.UTF-8',
locale => $postgresql_locale,
grant => 'all',
port => $port,
}
Expand Down
3 changes: 3 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@
$postgresql_ssl_key_path = "${postgresql_ssl_folder}/private_keys/${trusted['certname']}.pem"
$postgresql_ssl_ca_cert_path = "${postgresql_ssl_folder}/certs/ca.pem"

# Configuration of the locales
$postgresql_locale = 'C.UTF-8'

# certificates used for Jetty configuration
$ssl_set_cert_paths = false
$ssl_cert_path = "${ssl_dir}/public.pem"
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/classes/database/postgresql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}
end

it {

Check failure on line 58 in spec/unit/classes/database/postgresql_spec.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

puppetdb::database::postgresql on a supported platform manage database with defaults is expected to contain Postgresql::Server::Db[puppetdb] with user => "puppetdb", password => "puppetdb", grant => "all", port => 5432, encoding => "UTF8" and locale defined Failure/Error: is_expected.to contain_postgresql__server__db(params[:database_name]) .with( user: params[:database_username], password: params[:database_password], grant: 'all', port: params[:database_port].to_i, encoding: 'UTF8', locale: params[:postgresql_locale], ) expected that the catalogue would contain Postgresql::Server::Db[puppetdb] with locale undefined but it is set to "C.UTF-8"

Check failure on line 58 in spec/unit/classes/database/postgresql_spec.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

puppetdb::database::postgresql on a supported platform manage database with defaults is expected to contain Postgresql::Server::Db[puppetdb] with user => "puppetdb", password => "puppetdb", grant => "all", port => 5432, encoding => "UTF8" and locale defined Failure/Error: is_expected.to contain_postgresql__server__db(params[:database_name]) .with( user: params[:database_username], password: params[:database_password], grant: 'all', port: params[:database_port].to_i, encoding: 'UTF8', locale: params[:postgresql_locale], ) expected that the catalogue would contain Postgresql::Server::Db[puppetdb] with locale undefined but it is set to "C.UTF-8"
is_expected.to contain_postgresql__server__db(params[:database_name])
.with(
user: params[:database_username],
Expand All @@ -63,7 +63,7 @@
grant: 'all',
port: params[:database_port].to_i,
encoding: 'UTF8',
locale: 'en_US.UTF-8',
locale: params[:postgresql_locale],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

postgresql_locale does not appear in the params definition, so I would expect CI to fail, let's see…

)
}

Expand Down
Loading