Bug 2141308

Summary: It appears that the egg is downloaded every time
Product: Red Hat Satellite Reporter: Odilon Sousa <osousa>
Component: RH Cloud - InsightsAssignee: Shimon Shtein <sshtein>
Status: CLOSED ERRATA QA Contact: Jameer Pathan <jpathan>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.9.9CC: ahumbe, aruzicka, bbuckingham, jentrena, vijsingh
Target Milestone: 6.12.1Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-foreman_rh_cloud-6.0.44-1.el8sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2141348 2141366 2141367 (view as bug list) Environment:
Last Closed: 2023-01-18 14:53:14 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 Odilon Sousa 2022-11-09 13:15:48 UTC
Description of problem:

I am seeing around 100k downloads per hour. This leads me to believe that the client is downloading this information to do any sort of "should I refresh" logic instead of using some server side check. 


Expected results:

Ideally, if these files are not changed then the files are not downloaded.

Additional info:

Comment 5 Jameer Pathan 2022-12-23 12:21:06 UTC
Verified:

Verified with:
- Satellite 6.12.1 snap 1
- rubygem-foreman_rh_cloud-6.0.44-1.el8sat.noarch

Test steps:
- Register Satellite content host with insights.
- Run "insights-client" on the content host.
- Check /var/log/foreman/production.log on Satellite for insights-core.egg download requests.

Observations:
- Satellite 6.12 is now sending etag to https://cert-api.access.redhat.com/r/insights/v1/static/release/insights-core.egg
- response `304 NotModified` is returned from the server(meaning that client has the latest insights egg, so no need to re-download it).

Additional info:

---
On client:
# cat /etc/insights-client/.insights-core.etag
"47967884fa1b2a8974228a273f664f59:1671122618.166832"

# insights-client --version
Client: 3.1.7
Core: 3.1.2-1

# insights-client --net-debug
** trimmed output **
GET https://satellite.example.com:443/redhat_access/r/insights/v1/static/release/insights-core.egg
GET https://satellite.example.com:443/redhat_access/r/insights/v1/static/release/insights-core.egg
HTTP Status: 304 Not Modified
** trimmed output **


---
Satellite production.log:
** trimmed output **
2022-12-23T07:11:19 [I|app|d399d373] Started GET "/redhat_access/r/insights/v1/static/release/insights-core.egg" for <ip-address> at 2022-12-23 07:11:19 -0500
2022-12-23T07:11:19 [I|app|d399d373] Processing by InsightsCloud::Api::MachineTelemetriesController#forward_request as 
2022-12-23T07:11:19 [I|app|d399d373]   Parameters: {"path"=>"v1/static/release/insights-core"}
2022-12-23T07:11:19 [D|tax|d399d373] Current location set to none
2022-12-23T07:11:19 [D|tax|d399d373] Current organization set to none
2022-12-23T07:11:19 [D|app|d399d373] Request parameters for telemetry request: {"branch_id"=>"5a345722-d977-41ea-b53b-d473b972e38c"}
2022-12-23T07:11:19 [D|app|d399d373] User agent for telemetry is: Satellite/6.12.1;foreman_rh_cloud/6.0.44;insights-client/3.1.7 (Core 3.1.2; requests 2.20.0) Red Hat Enterprise Linux 8.7 (CPython 3.6.8; Linux 4.18.0-425.3.1.el8.x86_64); bash
2022-12-23T07:11:19 [D|app|d399d373] Sending headers: {:if_none_match=>"\"47967884fa1b2a8974228a273f664f59:1671122618.166832\""}
2022-12-23T07:11:19 [D|app|d399d373] Sending request to: https://cert-api.access.redhat.com/r/insights/v1/static/release/insights-core.egg
2022-12-23T07:11:19 [D|app|d399d373] Failed response with code 304 headers for request url https://cert-api.access.redhat.com/r/insights/v1/static/release/insights-core.egg are: {:last_modified=>"Thu, 15 Dec 2022 16:43:22 GMT", :etag=>"\"47967884fa1b2a8974228a273f664f59:1671122618.166832\"", :date=>"Fri, 23 Dec 2022 12:11:19 GMT", :connection=>"keep-alive", :content_disposition=>"attachment", :content_type=>"application/zip"} and body: 
2022-12-23T07:11:19 [I|app|d399d373] Completed 304 Not Modified in 112ms (Views: 0.3ms | ActiveRecord: 6.6ms | Allocations: 12308)
** trimmed output **

Comment 14 errata-xmlrpc 2023-01-18 14:53:14 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 (Critical: Satellite 6.12.1 Async Security Update), 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-2023:0261