puppetlabs / puppetlabs/puppetlabs-postgresql

config_entry removal incorrectly depends on existing value in postgresql.yml

Open
#1,656 1 comment 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 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:

  1. Have a this module properly setup and already running and managing a postgres instance
    This is a sample site.pp
  class { 'postgresql::globals':
    manage_package_repo => true,
    version             => '16',
  }

  class { 'postgresql::server': }
  1. Define a postgresql::server::config_entry resource in your site.pp. For example, initially set log_rotation_size to 45MB.
  postgresql::server::config_entry { 'log_rotation_size':
    value  => '45MB',
  }
  1. Run puppet agent -t and check that postgresql.yml contains the correct value
  postgresql::server::config_entry { 'log_rotation_size':
    ensure  => absent,
    value    => '50MB',
  }
  1. Add ensure => absent, and change the value to 50MB
  2. Run puppet agent -t. There should be a notice that log_rotation_size was removed ✅
  3. Check postgresql.yml for log_rotation_size and be amazed it's still there 🥹
  4. 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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.