Project

General

Profile

Actions

Bug #30205

closed

Request to /api/statuses returns 500 ISE when a smart proxy has "logs" feature disabled

Added by Pavel Moravec almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
-
Difficulty:
easy
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

(cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1850440)

Description of problem:
Disabling "logs" feature in internal or external smart proxy, 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):
any / current upstream

How reproducible:
100%

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

3. Check statuses API call on foreman:

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:

Actions #1

Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Pavel Moravec
  • Pull request https://github.com/theforeman/foreman/pull/7770 added
Actions #2

Updated by The Foreman Bot over 3 years ago

  • Fixed in Releases 2.2.0 added
Actions #3

Updated by Pavel Moravec over 3 years ago

  • Status changed from Ready For Testing to Closed
Actions #4

Updated by The Foreman Bot over 3 years ago

  • Pull request https://github.com/theforeman/foreman/pull/7975 added
Actions

Also available in: Atom PDF