Bug 2141366

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: high    
Version: 6.9.9CC: ahumbe, aruzicka, jpathan
Target Milestone: 6.10.7Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_rh_cloud-4.0.36-1.el7sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2141308 Environment:
Last Closed: 2022-11-17 13:46:59 UTC Type: ---
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 15:48:54 UTC
+++ This bug was initially created as a clone of Bug #2141308 +++

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 1 Jameer Pathan 2022-11-11 12:20:34 UTC
Verified:

Verified with:
- Satellite 6.10.7.1 snap 1
- tfm-rubygem-foreman_rh_cloud-4.0.36-1.el7sat.noarch

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

Observations:
- Satellite 6.10 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 
"9601f56ca5763f02fba4f3dbb6c4cf67:1668087134.043062"

# insights-client --version
Client: 3.1.7
Core: 3.0.303-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-11-11T07:12:29 [I|app|f8f4e4fc] Started GET "/redhat_access/r/insights/v1/static/release/insights-core.egg" for <ip-address> at 2022-11-11 07:12:29 -0500
2022-11-11T07:12:29 [I|app|f8f4e4fc] Processing by InsightsCloud::Api::MachineTelemetriesController#forward_request as 
2022-11-11T07:12:29 [I|app|f8f4e4fc]   Parameters: {"path"=>"v1/static/release/insights-core"}
2022-11-11T07:12:29 [D|tax|f8f4e4fc] Current location set to none
2022-11-11T07:12:29 [D|tax|f8f4e4fc] Current organization set to none
2022-11-11T07:12:29 [D|app|f8f4e4fc] Request parameters for telemetry request: {"branch_id"=>"99e683c4-79fc-4be6-8384-e0ff48a7eb7e"}
2022-11-11T07:12:29 [D|app|f8f4e4fc] User agent for telemetry is: Satellite/6.10.7;foreman_rh_cloud/4.0.36;insights-client/3.1.7 (Core 3.0.303; requests 2.6.0) Red Hat Enterprise Linux Server 7.9 (CPython 2.7.5; Linux 3.10.0-1160.80.1.el7.x86_64); systemd
2022-11-11T07:12:29 [D|app|f8f4e4fc] Sending headers: {:if_none_match=>"\"9601f56ca5763f02fba4f3dbb6c4cf67:1668087134.043062\""}
2022-11-11T07:12:29 [D|app|f8f4e4fc] Sending request to: https://cert-api.access.redhat.com/r/insights/v1/static/release/insights-core.egg
2022-11-11T07:12:29 [I|app|f8f4e4fc] Completed 304 Not Modified in 140ms (Views: 0.4ms | ActiveRecord: 8.7ms | Allocations: 10838)
** trimmed output **

Comment 6 errata-xmlrpc 2022-11-17 13:46:59 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 (Satellite 6.10.7.1 Async Bug Fix 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/RHBA-2022:8527