puppetlabs / puppetlabs/puppetlabs-postgresql
postgresql_psql failes with "no parameter named 'instance'
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 232
- Forks
- 610
- Avg merge
- 5d 23h
- Merged PRs (30d)
- 4
Description
Describe the Bug
I'm using puppetlabs-postgresql 10.3.0 together with puppetlabs-puppetdb 8.1.0.
In database/postgresql.pp manifest of puppetlabs-puppetdb, postgresql::server::extension class is called:
postgresql::server::extension { 'pg_trgm':
database => $database_name,
require => Postgresql::Server::Db[$database_name],
port => $port,
}
Within postgresql::server::extension, $instance has a default set to 'main'.
Then, postgresql_psql type is called the following way:
case $ensure {
'present': {
$command = "CREATE EXTENSION \"${extension}\""
$unless_mod = undef
$psql_cmd_require = $package_name ? {
undef => $default_psql_require,
default => [$default_psql_require, Package[$package_name]],
}
$psql_cmd_before = []
}
'absent': {
$command = "DROP EXTENSION \"${extension}\""
$unless_mod = 'NOT '
$psql_cmd_require = $default_psql_require
$psql_cmd_before = $package_name ? {
undef => [],
default => Package[$package_name],
}
}
default: {
fail("Unknown value for ensure '${ensure}'.")
}
}
$port_override = pick($connect_settings['PGPORT'], $port)
postgresql_psql { "${database}: ${command}":
psql_user => $user,
psql_group => $group,
psql_path => $psql_path,
connect_settings => $connect_settings,
db => $database,
port => $port_override,
command => $command,
instance => $instance,
unless => "SELECT 1 WHERE ${unless_mod}EXISTS (SELECT 1 FROM pg_extension WHERE extname = '${extension}')",
require => $psql_cmd_require,
before => $psql_cmd_before,
}
Unfortunately, this results in the following error:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: no parameter named 'instance' (file: /data/puppet/code/environments/testing/modules/postgresql/manifests/server/extension.pp, line: 83) on Postgresql_psql[puppetdb: CREATE EXTENSION "pg_trgm"] (file: /data/puppet/code/environments/testing/modules/postgresql/manifests/server/extension.pp, line: 83) on node *****.***.lan
My guess is that this fails due to quoting problems. A string containing double quotes is assigned to $command variable.
Maybe they break the double quotes in postgresql_psql { "${database}: ${command}":.
Expected Behavior
No mysterious error complaining about missing parameters which are acutally properly defined.
Steps to Reproduce
Steps to reproduce the behavior:
- Update PuppetDB OS from Ubuntu 20.04 to 22.04
- Update Puppet Modules
2.1mod 'puppet-puppetboard', '9.0.0'=>mod 'puppet-puppetboard', '10.0.0'
2.2mod 'puppetlabs-puppetdb', '7.13.0'=>mod 'puppetlabs-puppetdb', '8.1.0'
2.3mod 'puppetlabs-postgresql', '9.0.3'=>mod 'puppetlabs-postgresql', '10.3.0' - Run Puppet @ PuppetDB server
Environment
- Puppet Server Version [8.6.0]
- Puppet Agent Version [8.7.0]
- Platform [Ubuntu 22.04]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in manifests/server/extension.pp at the postgresql_psql resource declaration and inspect the postgresql_psql type definition to compare its supported parameters with the passed instance value. Reproduce the PuppetDB extension deployment described in the issue, then verify that the extension resource catalogs and applies without the unknown-parameter error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100