puppetlabs / puppetlabs/puppetlabs-postgresql

When there is a dash `-` in the instance name, the `Postgresql_conf` defined resource fails

Open
#1,623 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
232
Forks
610
Avg merge
5d 23h
Merged PRs (30d)
4

Description

Describe the Bug

When there is a dash - in the instance name, the Postgresql_conf defined resource fails

profile::postgres::instances:
  "%{facts.networking.hostname}":
    instance_user: "postgres"
    instance_group: "postgres"

We want to build the instance based off the hostname, as in our environment its 1 server for 1 instance.

For example
Given:

root@TEST-PG-1234:[~]: puppet facts | grep hostname
    "hostname": "TEST-PG-1234",

Error:

Error: Failed to apply catalog: Parameter name failed on Postgresql_conf[authentication_timeout_TEST-PG-1234]: Invalid value "authentication_timeout_TEST-PG-1234". Valid values match /^[\w.]+$/.(file:/etc/puppetlabs/code/environments/dash_test/modules/postgresql/manifests/server/config_entry.pp, line: 89)

I think its related to this:

https://github.com/puppetlabs/puppetlabs-postgresql/blob/ab7e59e8cd7528dc13cf50fec8353cbbc6b8bfcf/lib/puppet/type/postgresql_conf.rb#L9

Expected Behavior

Puppet should be okay with dashes in the resource name.

Steps to Reproduce

Steps to reproduce the behavior:
Build an instance with dashes in the name.

Environment

  • Puppet 8.10.0
  • Red Hat Enterprise Linux release 8.10 (Ootpa)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect lib/puppet/type/postgresql_conf.rb around line 9 and server/config_entry.pp around line 89, where the reported validation failure occurs. Reproduce the catalog with the TEST-PG-1234 hostname and verify that Postgresql_conf accepts the generated resource name containing dashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, ruby
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.