Bug 1850440 - "hammer status" returns 500 ISE when a Capsule or Satellite has foreman-proxy "logs" feature disabled
Summary: "hammer status" returns 500 ISE when a Capsule or Satellite has foreman-proxy...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.7.0
Hardware: x86_64
OS: Linux
low
medium vote
Target Milestone: 6.9.0
Assignee: Pavel Moravec
QA Contact: Petr Pochop
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-24 10:20 UTC by Pavel Moravec
Modified: 2021-12-01 10:51 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1919430 (view as bug list)
Environment:
Last Closed: 2021-04-21 13:14:56 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 30205 0 Normal Closed Request to /api/statuses returns 500 ISE when a smart proxy has "logs" feature disabled 2021-01-21 16:41:19 UTC
Red Hat Knowledge Base (Solution) 5180551 0 None None None 2020-06-24 10:38:49 UTC
Red Hat Product Errata RHSA-2021:1313 0 None None None 2021-04-21 13:17:14 UTC

Description Pavel Moravec 2020-06-24 10:20:29 UTC
Description of problem:
Disabling "logs" feature in foreman-proxy of Satellite or a Capsule, API request:

/api/statuses

returns 500 error.

The reason is evident from source code:

https://github.com/theforeman/foreman/blob/develop/app/services/ping.rb#L66 :

    def statuses_smart_proxies
      results = []
      SmartProxy.all.includes(:features).map do |proxy|
        start = Time.now
        begin
          version = proxy.statuses[:version].version['version']
          features = proxy.statuses[:version].version['modules']
          failed_features = proxy.statuses[:logs].logs.failed_modules
..

The proxy without logs feature has proxy.statuses without :logs :-/

The line should be like:

          failed_features = (proxy.statuses[:logs].nil? ? {} : proxy.statuses[:logs].logs.failed_modules)


Version-Release number of selected component (if applicable):
Sat6.7


How reproducible:
100%


Steps to Reproduce:
1. Have an external Capsule
2. On the Capsule, disable "logs" feature:
satellite-installer --scenario=capsule --foreman-proxy-logs=false

3. Check statuses API call on Satellite:

curl -L -u admin:mysecret007 http://$(hostname -f)/api/statuses


Actual results:
{
  "error": {"message":"Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs."}
}


Expected results:
{"results":{ ... (some usual output)


Additional info:

Comment 1 Bryan Kearney 2020-06-24 16:05:17 UTC
Upstream bug assigned to pmoravec@redhat.com

Comment 2 Bryan Kearney 2020-06-24 16:05:19 UTC
Upstream bug assigned to pmoravec@redhat.com

Comment 4 Pavel Moravec 2020-06-25 11:36:08 UTC
The foreman-proxy "logs" feature was added in 6.4-ish release. Any newer Satellite deployment (not upgraded from that version) should have the feature enabled by default and work well.

BUT any Satellite upgraded from 6.4ish version will have the feature _disabled_ by default, causing "hammer status" (that calls the API request) to fail - by default..

Comment 5 Bryan Kearney 2020-07-05 16:05:08 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30205 has been resolved.

Comment 6 Brad Buckingham 2020-11-13 19:27:59 UTC
Fix is in Satellite 6.9 SNAP 1 with foreman-2.3.0-0.7.rc1.el7sat.noarch

Comment 8 Petr Pochop 2021-03-10 12:35:56 UTC
Verified
On Sat 6.9 snap 15.0

Disabled logging on internal and external capsules. Either way didn't cause any problems, I could access the api and get the status, this time without the "logs" feature listed, as expected.

Comment 11 errata-xmlrpc 2021-04-21 13:14:56 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.9 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-2021:1313


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