Skip to content

unless check in postgresql::server::instance::passwd does not respect custom database name (missing --dbname option) #1639

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

Open
asusk7m550 opened this issue Jun 12, 2025 · 0 comments · May be fixed by #1640

Comments

@asusk7m550
Copy link

Describe the Bug

The unless command in postgresql::server::instance::passwd does not include the --dbname option when the database name differs from the user name. This can cause the check to run against the wrong database, potentially resulting in incorrect behavior when setting the postgres password.

Expected Behavior

The unless command should always connect to the intended database by including the --dbname option when necessary, just like the main command. This ensures the password check is performed against the correct database.

Steps to Reproduce

  1. Set up a PostgreSQL instance where the database name is different from the user name.
  2. Apply the Puppet manifest to set the postgres password.
  3. Observe that the unless check may not work as intended, causing the password to be reset unnecessarily or not at all.

Environment

  • Version: puppetlabs-postgresql v10.5.0
  • Platform: -

Additional Context

A patch is proposed to add ${_dboption} to the unless command, ensuring consistent database selection:

unless => "${shell_escape($psql_path)}${_dboption} -h localhost -p ${port} -c 'select 1' > /dev/null",
@asusk7m550 asusk7m550 changed the title When using unless check in postgresql::server::instance::passwd does not respect custom database name (missing --dbname option) Jun 12, 2025
asusk7m550 added a commit to asusk7m550/puppetlabs-postgresql that referenced this issue Jun 12, 2025
…:passwd does not respect custom database name (missing --dbname option)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant