theforeman / foreman_rh_cloud

a plugin to Foreman that generates and uploads reports to the Red Hat cloud
GNU General Public License v3.0
6 stars 30 forks source link

Requests to /api/insights/v1/system/<uuid>/reports lack trailing slash #895

Open PaulWay opened 3 weeks ago

PaulWay commented 3 weeks ago

At the moment the Foreman client seems to be making requests on behalf of the Insights client to:

/api/insights/v1/system/<uuid>/reports?branch_id=<branch_id>.

This lacks a trailing slash, which causes the API to return a 301 redirect to:

/api/insights/v1/system/<uuid>/reports/?branch_id=<branch_id>.

Which the client immediately follows. This causes two requests and two jobs to process one request, leading to increased work and delays in both Satellite and the Insights Advisor API.

We would like to make sure that only the latter URL is requested.

Versions affected:

Satellite 6.11.5.6, 6.11.5.7, 6.12.5.3, 6.13.1, 6.13.7, 6.14.2, 6.14.4, 6.14.4.1, 6.15.1, 6.15.2 foreman_rh_cloud 5.0.46, 6.0.45, 7.0.45, 7.0.48, 8.0.51, 9.0.56 insights-client 3.1.9, 3.2.2

ShimShtein commented 3 weeks ago

Also tracked in https://issues.redhat.com/browse/SAT-27374

PaulWay commented 3 weeks ago

I'm happy to submit a patch or PR for this, I'm just struggling to see where this URL is constructed or comes from.