puppetlabs-postgresql icon indicating copy to clipboard operation
puppetlabs-postgresql copied to clipboard

don't set data_directory in the config by default

Open evgeni opened this issue 2 years ago • 0 comments

Describe the Bug

Today, we always set data_directory = … in postgresql.conf via https://github.com/puppetlabs/puppetlabs-postgresql/blob/411e7bce3f2d5256c315351144dc525b6c0afbbe/manifests/server/instance/config.pp#L222-L225

However we also set it in the systemd override: https://github.com/puppetlabs/puppetlabs-postgresql/blob/411e7bce3f2d5256c315351144dc525b6c0afbbe/manifests/server/instance/systemd.pp#L29-L34 https://github.com/puppetlabs/puppetlabs-postgresql/blob/411e7bce3f2d5256c315351144dc525b6c0afbbe/templates/systemd-override.conf.epp#L11

And pass it when calling initdb: https://github.com/puppetlabs/puppetlabs-postgresql/blob/411e7bce3f2d5256c315351144dc525b6c0afbbe/manifests/server/instance/initdb.pp#L153

The problem is that setting data_directory in the config actually overrides the -D parameter on the CLI and the PGDATA environment variable, as can be seen in e.g. https://bugzilla.redhat.com/show_bug.cgi?id=1935301 thus possibly breaking future actions against this DB (see the link for an example, also https://www.postgresql.org/message-id/3566642.1618422939%40sss.pgh.pa.us).

Expected Behavior

data_directory not set in postgresql.conf when systemd is used and thus the environment variable is present

Steps to Reproduce

install a postgresql setup :)

Environment

  • Version 10.0.3
  • Platform CentOS Stream 8

Additional Context

This is the exact opposite of #510 :woman_shrugging:

evgeni avatar Feb 21 '24 08:02 evgeni