Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2029807 - foreman-maintain service fails for external postgres service, when no psql utility installed
Summary: foreman-maintain service fails for external postgres service, when no psql ut...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Satellite Maintain
Version: 6.10.1
Hardware: All
OS: All
unspecified
high
Target Milestone: 6.11.0
Assignee: Amit Upadhye
QA Contact: Gaurav Talreja
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-07 11:00 UTC by Gaurav Talreja
Modified: 2022-09-19 06:07 UTC (History)
7 users (show)

Fixed In Version: rubygem-foreman_maintain-1.0.10
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:30:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34855 0 Normal Ready For Testing Require psql for foreman-maintain 2022-05-02 11:07:40 UTC
Red Hat Knowledge Base (Solution) 6962608 0 None None None 2022-06-09 12:38:15 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:31:02 UTC

Description Gaurav Talreja 2021-12-07 11:00:36 UTC
Description of problem:
foreman-maintain service fails for external Postgres service when no psql utility is installed with message unable to connect to the remote database.


Version-Release number of selected component (if applicable):
Satellite 6.10.1.1
rubygem-foreman_maintain-0.8.21-1.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
1. Configure repos for satellite, and install satellite package.
2. Install and configure Postgres on rhel as per documentation[1]
3. Run the installer as mentioned in documention[1] to configure satellite with external DB, which fails with BZ 2029793
4. Check the status of the external PostgreSQL service, which fails with the following message,
# foreman-maintain service status --only postgresql
Running Status Services
================================================================================
Get status of applicable services:

Displaying the following service(s):
postgresql (pulpcore), postgresql (candlepin), postgresql (foreman)
/ displaying postgresql (pulpcore)
postgresql (pulpcore) is remote and is DOWN.
  Unable to connect to the remote database.
  See the log (/var/log/foreman-maintain/foreman-maintain.log) for more details.
/ displaying postgresql (candlepin)
postgresql (candlepin) is remote and is DOWN.
  Unable to connect to the remote database.
  See the log (/var/log/foreman-maintain/foreman-maintain.log) for more details.
/ displaying postgresql (foreman)
postgresql (foreman) is remote and is DOWN.
  Unable to connect to the remote database.
  See the log (/var/log/foreman-maintain/foreman-maintain.log) for more details.
/ All services displayed                                              [FAIL]
Some services are not running (postgresql (pulpcore), postgresql (candlepin), postgresql (foreman))
--------------------------------------------------------------------------------


Actual results:
a message like, "Unable to connect to the remote database, see logs"

Expected results:
Message something like, "The psql command not found. Make sure the system has a psql utility installed."


Additional info:
This BZ[2] has provided a similar fail-safe option for backup/restore when psql is unavailable with methods like "psql_cmd_available?" for Postgres and "mongo_cmd_available?" for Mongo.


[1] https://access.redhat.com/documentation/en-us/red_hat_satellite/6.10/html/installing_satellite_server_from_a_connected_network/performing-additional-configuration#using-external-databases_satellite
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1921295

Comment 1 Amit Upadhye 2021-12-13 11:18:58 UTC
Created redmine issue https://projects.theforeman.org/issues/34136 from this bug

Comment 3 Amit Upadhye 2022-05-11 12:07:42 UTC
The 6.11 should stay in 1.0.x versions and accordingly correct version to pick is 1.0.10 and there are cherry picks of psql dependency in that,

https://github.com/theforeman/foreman-packaging/pull/7887

Comment 4 Gaurav Talreja 2022-05-23 18:12:58 UTC
Verified.

Tested on Satellite 6.11.0 Snap 21.0
Version: rubygem-foreman_maintain-1.0.10-1.el7sat.noarch

Steps:
1. Install satellite/rubygem-foreman_maintain packages

Observation:
psql utility comes with a package "rh-postgresql12-postgresql-syspaths" for el7, which is now added as direct dependency to `rubygem-foreman_maintain` package, which fixes both BZ 2029793 and this BZ. 
For EL8 and onward, it is done similarly by requiring /usr/bin/psql in the spec file of `rubygem-foreman_maintain` package.

```
Installed:
  rubygem-foreman_maintain.noarch 1:1.0.10-1.el7sat

Dependency Installed:
  rh-postgresql12-postgresql.x86_64 0:12.9-1.el7                        rh-postgresql12-postgresql-libs.x86_64 0:12.9-1.el7
  rh-postgresql12-postgresql-syspaths.x86_64 0:12.9-1.el7               rh-postgresql12-runtime.x86_64 0:3.4-1.el7
  ruby.x86_64 0:2.0.0.648-39.el7_9                                      ruby-irb.noarch 0:2.0.0.648-39.el7_9
  ruby-libs.x86_64 0:2.0.0.648-39.el7_9                                 rubygem-bigdecimal.x86_64 0:1.2.0-39.el7_9
  rubygem-clamp.noarch 0:1.1.2-7.el7sat                                 rubygem-highline.noarch 0:2.0.3-2.el7sat
  rubygem-io-console.x86_64 0:0.4.2-39.el7_9                            rubygem-json.x86_64 0:1.7.7-39.el7_9
  rubygem-psych.x86_64 0:2.0.0-39.el7_9                                 rubygem-rdoc.noarch 0:4.0.0-39.el7_9
  rubygems.noarch 0:2.0.14.1-39.el7_9                                   scl-utils.x86_64 0:20130529-19.el7

Complete!
```

Comment 7 errata-xmlrpc 2022-07-05 14:30:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5498


Note You need to log in before you can comment on or make changes to this bug.