puppetlabs / puppetlabs/puppetlabs-postgresql
config_entry removal incorrectly depends on existing value in postgresql.yml
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 setting postgresql::server::config_entry resources to ensure => absent, the provider incorrectly requires the provided value to either match the one currently in postgresql.yml or be empty (undef, or anything that renders as an empty string).
The confusing behavior is that if the value provided does not match what's in postgresql.yml, Puppet will output that it's removing the configuration, but the entry remains in the file. As a result, every subsequent run repeats the same “removal” message, creating an endless loop of false reporting.
Expected Behavior
When ensure is set to absent, the provider should just completely ignore the value field.
Steps to Reproduce
Steps to reproduce the behavior:
- Have a this module properly setup and already running and managing a postgres instance
This is a samplesite.pp
class { 'postgresql::globals':
manage_package_repo => true,
version => '16',
}
class { 'postgresql::server': }
- Define a
postgresql::server::config_entryresource in yoursite.pp. For example, initially setlog_rotation_sizeto45MB.
postgresql::server::config_entry { 'log_rotation_size':
value => '45MB',
}
- Run
puppet agent -tand check thatpostgresql.ymlcontains the correct value
postgresql::server::config_entry { 'log_rotation_size':
ensure => absent,
value => '50MB',
}
- Add
ensure => absent,and change the value to50MB - Run
puppet agent -t. There should be a notice thatlog_rotation_sizewas removed ✅ - Check
postgresql.ymlforlog_rotation_sizeand be amazed it's still there 🥹 - Repeat the last 2 steps and go insane
pp_postgresql_conif_entries_bug.log
Environment
- Version v10.6.1
- Platform [e.g. Ubuntu 24.04]
Additional Context
Add any other context about the problem here.
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 by reproducing the issue from the provided site.pp example and inspect the postgresql::server::config_entry provider behavior for ensure => absent. Check postgresql.yml after changing the value, then verify that the entry is removed and subsequent Puppet runs no longer report a repeated removal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, ruby
- Domain
- databases, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100