Bug 2257980

Summary: Ensure PostgreSQL systemd service ensures the existence of the mount point before starting
Product: Red Hat Satellite Reporter: Ganesh Payelkar <gpayelka>
Component: InstallationAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED MIGRATED QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.14.1CC: ahumbe, ehelms, ekohlvan, jpasqual, neal.dudley, rlavi
Target Milestone: UnspecifiedKeywords: MigratedToJIRA, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-06 16:40:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ganesh Payelkar 2024-01-11 22:24:44 UTC
Description of problem:

Upon creating a custom drop-in file for PostgreSQL (postgresql-fs-mount-reqs.conf), I noticed that the installer intentionally removed this file during its execution.

Version-Release number of selected component (if applicable):
satellite-6.14

How reproducible:
When creating a custom configuration

Steps to Reproduce:

To reproduce the behavior where the custom configuration file for PostgreSQL is removed during the Satellite installation, you can follow these steps:

1. Navigate to the directory where PostgreSQL drop-in configurations are stored:

   # cd /etc/systemd/system/postgresql.service.d


2. Create a custom drop-in configuration file:

    # touch postgresql-fs-mount-reqs.conf

3. Verify the existence of the custom drop-in file:
    # ls -l
   The output should include `postgresql-fs-mount-reqs.conf`.
   -r--r--r--. 1 root root 73 Dec 19 08:05 postgresql.conf
   -rw-r--r--. 1 root root  0 Jan 12 03:08 postgresql-fs-mount-reqs.conf

4. Run the Satellite installer:
   satellite-installer -S satellite

5. Monitor the installer logs for any actions related to the custom drop-in file:
   # tail -f /var/log/foreman-installer/satellite.log

2024-01-12 02:51:34 [DEBUG ] [configure] /File[/etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf]/seluser: Found seluser default 'system_u' for /etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf
2024-01-12 02:51:34 [DEBUG ] [configure] /File[/etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf]/selrole: Found selrole default 'object_r' for /etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf
2024-01-12 02:51:34 [DEBUG ] [configure] /File[/etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf]/seltype: Found seltype default 'postgresql_unit_file_t' for /etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf
2024-01-12 02:51:34 [DEBUG ] [configure] /File[/etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf]/selrange: Found selrange default 's0' for /etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf
2024-01-12 02:51:34 [DEBUG ] [configure] /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Instance::Config[main]/Postgresql::Server::Instance::Systemd[postgresql]/Systemd::Dropin_file[postgresql.conf]/File[/etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf]: Starting to evaluate the resource (1320 of 2192)
2024-01-12 02:51:34 [DEBUG ] [configure] /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Instance::Config[main]/Postgresql::Server::Instance::Systemd[postgresql]/Systemd::Dropin_file[postgresql.conf]/File[/etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf]: Removing existing file for replacement with absent
2024-01-12 02:51:34 [INFO  ] [configure] /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Instance::Config[main]/Postgresql::Server::Instance::Systemd[postgresql]/Systemd::Dropin_file[postgresql.conf]/File[/etc/systemd/system/postgresql.service.d/postgresql-fs-mount-reqs.conf]/ensure: removed

6. After the installation completes, check the contents of the directory:
    # ls -l
     -r--r--r--. 1 root root 73 Dec 19 08:05 postgresql.conf
   The custom drop-in file may no longer be present.




Actual results:

After running the satellite-installer command for Satellite, I observed that the installer process removed the custom drop-in file, as evidenced by both the absence of the file and corresponding log entries indicating its removal.
the satellite installer appears to delete custom configurations during the installation process. 

Expected results:

The expected result would be that the custom PostgreSQL drop-in configuration file (postgresql-fs-mount-reqs.conf) remains intact even after running the Satellite installer. The installer should not remove custom configurations that are essential for ensuring proper PostgreSQL startup dependencies, such as mount points.

Additional info:


Tested on satellite 6.13 and it does not remove it.

Comment 3 Ewoud Kohl van Wijngaarden 2024-01-15 17:13:33 UTC
This is a result of https://github.com/puppetlabs/puppetlabs-postgresql/commit/5eb1e8edb825a0ee1377db0ecf7af1646452df94 where it now uses the common puppet-systemd module. That has this piece of code https://github.com/voxpupuli/puppet-systemd/blob/00915e3ac17d11b34d1821fa1b76752b99a3d387/manifests/dropin_file.pp#L56-L57 which purges the systemd drop ins directory for a service.

There is a systemd::purge_dropin_dirs option you can define in custom-hiera.yaml but we should investigate the effects. I don't think it will hurt things, but it will also change the drop ins for other services. With Apache it probably isn't an issue, but we could rely on it with our dynflow or pulp worker configuration (when you scale down the number of workers).

Comment 4 Ewoud Kohl van Wijngaarden 2024-03-25 12:49:08 UTC
With the upcoming version of puppet-systemd it will be possible to create managed dropins using custom-hiera.yaml, but we generally call that unsupported so it won't be documented.

For this specific case I've opened https://github.com/puppetlabs/puppetlabs-postgresql/pull/1582 to always make sure the mounts are available. There is a clear benefit to this for all users. This saves the customer from manually managing this and also provides value to other customers implementing the same partitioning scheme (which is common).

Comment 5 Eric Helms 2024-06-06 16:40:46 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.