Skip to content

config_entry removal incorrectly depends on existing value in postgresql.yml #1656

@davidassigbi

Description

@davidassigbi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions