Bug 2029395

Summary: insights-client --register --verbose throwing error UnicodeEncodeError: 'ascii' codec can't encode character '\ufffd' in position 94: ordinal not in range(128)
Product: Red Hat Enterprise Linux 8 Reporter: Shivam Gupta <shivagup>
Component: insights-clientAssignee: Link Dupont <link>
Status: CLOSED ERRATA QA Contact: Pavol Kotvan <pakotvan>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.5CC: achadha, cmarinea, fjansen, gardar.arnarsson, gchamoul, hakon.gislason, jentrena, jsenkyri, karnsing, link, ngupta, pakotvan, pmendezh, psuba, sshashi
Target Milestone: rcKeywords: Reopened, Triaged
Target Release: 8.8   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: insights-client-3.1.7-10.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2130596 2141087 (view as bug list) Environment:
Last Closed: 2023-05-16 08:30:42 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:
Bug Depends On:    
Bug Blocks: 2130596, 2141087    

Description Shivam Gupta 2021-12-06 11:56:22 UTC
Description of problem: insights-client --register --verbose is throwing error messages while using it in kickstart file:-

--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\ufffd' in position 94: ordinal not in range(128)
Call stack:
  File "/usr/lib/python3.6/site-packages/insights_client/run.py", line 18, in <module>
    sys.exit(phase())
  File "/etc/insights-client/rpm.egg/insights/client/phase/v1.py", line 32, in _f
    func(client, config)
  File "/etc/insights-client/rpm.egg/insights/client/phase/v1.py", line 129, in update
    client.update()
  File "/etc/insights-client/rpm.egg/insights/client/__init__.py", line 258, in update
    egg_paths = self.fetch()
  File "/etc/insights-client/rpm.egg/insights/client/__init__.py", line 157, in fetch
    force)
  File "/etc/insights-client/rpm.egg/insights/client/__init__.py", line 72, in _init_connection
    return func(self, *args, **kwargs)
  File "/etc/insights-client/rpm.egg/insights/client/__init__.py", line 208, in _fetch
    response = self.connection.get(url)
  File "/etc/insights-client/rpm.egg/insights/client/connection.py", line 195, in get
    return self._http_request(url, 'GET', **kwargs)
  File "/etc/insights-client/rpm.egg/insights/client/connection.py", line 191, in _http_request
    logger.log(NETWORK, "HTTP Response Text: %s", res.text)
Message: 'HTTP Response Text: %s'
Arguments: ('PK\x03\x04\n\x00\x00\x00\x00\x00\x00\x00!L\ufffd\x06\ufffd2\x01\x00\x00\x00\x01\x00\x00\x00\x1d\x00\x00\x00EGG-INFO/dependency_links.txt\nPK\x03\x04\x14\x00\x00\x00\x08\x00\x00\x00!L\ufffd\ufffd\u02e0\ufffd\x00\x00\x00\ufffd\x01\x00\x00\x19\x00\x00\x00EGG-INFO/entry_points.txte\ufffdQ\x0e\ufffd \x0c\ufffd\ufffd=\ufffd\x17\ufffd\x070\ufffdI\ufffd\u0150\ufffdic\ufffd\ufffd\x83\ufffd\ufffd\t\ufffd!<\ufffd\ufffd\ufffd_\ufffd\ufffd@\ufffd\n\ufffd\x10\ufffdG}w\ufffd\ufffd.\ufffd\u03de\ufffd\u04b2F\x1d2\x19Cr\ufffd\ufffdn\ufffdXk\ufffd<y\x13\x14\ufffdh\r\ufffd\ufffd\x07\ufffd\u06e8(\ufffdG\ufffd\ufffdZ\x13f\ufffd\ufffd\ufffd\x19U\ufffd\ufffd\ufffd;\ufffd\x08[;\ufffd\x08\ufffd\x1a\ufffd\ufffd\ufffd\ufffd7a\ufffd\x1bS}\ufffdI\ufffd\ufffd\ufffdt\x1aUO\ufffd\ufffd\ufffde\ufffdb\ufffdz\x1c\ufffd\ufffdrx\\pa,\ufffd)\x12\x0f\x19g\ufffd\ufffd\x01PK\x03\x04\x14\x00\x00\x00\x08\x00\x00\x00!L\ufffd\x1f@@@



Version-Release number of selected component (if applicable): 
- insights-client-3.1.7-1.el8_5.noarch
- RHEL8.5

Comment 7 Link Dupont 2022-06-17 10:31:44 UTC
The upstream fix to the CDN has been deployed, and HTTP responses now set the correct content-type header.

$ sudo curl -I --cacert /etc/insights-client/cert-api.access.redhat.com.pem --cert /etc/pki/consumer/cert.pem --key /etc/pki/consumer/key.pem https://cert-api.access.redhat.com/r/insights/v1/static/release/insights-core.egg
HTTP/1.1 200 OK
Accept-Ranges: bytes
ETag: "337703f5efb120315953fecf1cba5ce5:1655130703.369429"
Last-Modified: Mon, 13 Jun 2022 14:31:34 GMT
Server: AkamaiNetStorage
Content-Length: 1276395
Date: Fri, 17 Jun 2022 10:28:52 GMT
Connection: keep-alive
Content-Type: application/zip

Comment 28 Link Dupont 2022-11-08 15:32:10 UTC
Steps to Reproduce:

1) rm /var/lib/insights/last_stable.egg*
2) rm /etc/insights-client/insights-core.etag
3) insights-client --verbose


Additional info:

Because the egg used during the first run of insights-client is /etc/insights-client/rpm.egg, and because the etag file does not exist, and because /etc/insights-client/rpm.egg does not contain the fixes to the logging that were made after insights-client-3.1.7 was released, when insights-client downloads the latest egg, it erroneously logs it. This is why it is only occurring during first boot, kickstart %post scriptlets, etc.

This will require an updated RPM in order to fix.

Comment 40 errata-xmlrpc 2023-05-16 08:30:42 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 (insights-client bug fix and enhancement 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-2023:2803