Bug 1850624
| Summary: | Uncaught JSONDecodeError when content_access.json is empty and registering to Satellite6 | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Pavel Moravec <pmoravec> |
| Component: | subscription-manager | Assignee: | William Poteat <wpoteat> |
| Status: | CLOSED ERRATA | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 8.3 | CC: | cdonnell, csnyder, jhnidek, jsefler, ktordeur, molasaga, redakkan, yanpliu |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-05-18 13:32:41 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: | |||
The problem was noticed when registering a system against Satellite 6.6 as well. I am able to reproduce it against my Sat6.7 only. Registration to my Sat6.6 works well - maybe the call flow / error depends on some Satellite setting..? Testing against RHEL-8.4.0-20201130.n.1: [root@dhcp-8-29-107 ~]# rpm -q subscription-manager subscription-manager-1.28.6-1.el8.x86_64 >> Reproducing issue (subscription-manager-1.26.20-1.el8_2.x86_64): [root@dhcp-8-29-107 yum.repos.d]# subscription-manager unregister Unregistering from: sat68:443/rhsm System has been unregistered. [root@dhcp-8-29-107 yum.repos.d]# rm /var/lib/rhsm/cache/content_access.json rm: remove regular file '/var/lib/rhsm/cache/content_access.json'? y [root@dhcp-8-29-107 yum.repos.d]# touch /var/lib/rhsm/cache/content_access.json [root@dhcp-8-29-107 yum.repos.d]# subscription-manager register Registering to: sat68:443/rhsm Username: admin Password: The system has been registered with ID: 99e9521c-f314-4090-a8d9-1e21a8fc9b98 The registered system name is: client Traceback (most recent call last): File "/usr/sbin/subscription-manager", line 11, in <module> load_entry_point('subscription-manager==1.26.20', 'console_scripts', 'subscription-manager')() File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 87, in main return managercli.ManagerCLI().main() File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2996, in main ret = CLI.main(self) File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main return cmd.main() File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 536, in main return_code = self._do_command() File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1434, in _do_command self.entcertlib.update() File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 32, in update self.report = self.locker.run(self._do_update) File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 18, in run return action() File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 42, in _do_update return action.perform() File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 141, in perform self.content_access_hook() File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 194, in content_access_hook update_data = self.content_access_cache.check_for_update() File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 696, in check_for_update data = json.loads(self.read()) File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) [root@dhcp-8-29-107 yum.repos.d]# subscription-manager unregister Unregistering from: sat68:443/rhsm System has been unregistered. >> Updating to nightly version: [root@dhcp-8-29-107 yum.repos.d]# yum update subscription-manager Updating Subscription Management repositories. Unable to read consumer identity This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Last metadata expiration check: 0:00:48 ago on Mon 30 Nov 2020 11:25:32 PM EST. Dependencies resolved. ================================================================================================================================== Package Architecture Version Repository Size ================================================================================================================================== Upgrading: dnf-plugin-subscription-manager x86_64 1.28.6-1.el8 rhel-8-nightly-baseos-rpms 290 k python3-subscription-manager-rhsm x86_64 1.28.6-1.el8 rhel-8-nightly-baseos-rpms 363 k subscription-manager x86_64 1.28.6-1.el8 rhel-8-nightly-baseos-rpms 1.1 M subscription-manager-rhsm-certificates x86_64 1.28.6-1.el8 rhel-8-nightly-baseos-rpms 263 k Transaction Summary ================================================================================================================================== Upgrade 4 Packages Total download size: 2.0 M Is this ok [y/N]: y Downloading Packages: (1/4): dnf-plugin-subscription-manager-1.28.6-1.el8.x86_64.rpm 1.1 MB/s | 290 kB 00:00 (2/4): python3-subscription-manager-rhsm-1.28.6-1.el8.x86_64.rpm 1.3 MB/s | 363 kB 00:00 (3/4): subscription-manager-1.28.6-1.el8.x86_64.rpm 2.5 MB/s | 1.1 MB 00:00 (4/4): subscription-manager-rhsm-certificates-1.28.6-1.el8.x86_64.rpm 1.2 MB/s | 263 kB 00:00 ---------------------------------------------------------------------------------------------------------------------------------- Total 4.2 MB/s | 2.0 MB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: subscription-manager-rhsm-certificates-1.28.6-1.el8.x86_64 1/1 Upgrading : subscription-manager-rhsm-certificates-1.28.6-1.el8.x86_64 1/8 Upgrading : python3-subscription-manager-rhsm-1.28.6-1.el8.x86_64 2/8 Upgrading : dnf-plugin-subscription-manager-1.28.6-1.el8.x86_64 3/8 Upgrading : subscription-manager-1.28.6-1.el8.x86_64 4/8 warning: /etc/rhsm/rhsm.conf created as /etc/rhsm/rhsm.conf.rpmnew Running scriptlet: subscription-manager-1.28.6-1.el8.x86_64 4/8 chmod: cannot access '/etc/pki/entitlement/*.pem': No such file or directory Running scriptlet: subscription-manager-1.26.20-1.el8_2.x86_64 5/8 Cleanup : subscription-manager-1.26.20-1.el8_2.x86_64 5/8 Running scriptlet: subscription-manager-1.26.20-1.el8_2.x86_64 5/8 Cleanup : python3-subscription-manager-rhsm-1.26.20-1.el8_2.x86_64 6/8 Cleanup : subscription-manager-rhsm-certificates-1.26.20-1.el8_2.x86_64 7/8 Cleanup : dnf-plugin-subscription-manager-1.26.20-1.el8_2.x86_64 8/8 Running scriptlet: dnf-plugin-subscription-manager-1.26.20-1.el8_2.x86_64 8/8 Verifying : dnf-plugin-subscription-manager-1.28.6-1.el8.x86_64 1/8 Verifying : dnf-plugin-subscription-manager-1.26.20-1.el8_2.x86_64 2/8 Verifying : python3-subscription-manager-rhsm-1.28.6-1.el8.x86_64 3/8 Verifying : python3-subscription-manager-rhsm-1.26.20-1.el8_2.x86_64 4/8 Verifying : subscription-manager-1.28.6-1.el8.x86_64 5/8 Verifying : subscription-manager-1.26.20-1.el8_2.x86_64 6/8 Verifying : subscription-manager-rhsm-certificates-1.28.6-1.el8.x86_64 7/8 Verifying : subscription-manager-rhsm-certificates-1.26.20-1.el8_2.x86_64 8/8 Installed products updated. Upgraded: dnf-plugin-subscription-manager-1.28.6-1.el8.x86_64 python3-subscription-manager-rhsm-1.28.6-1.el8.x86_64 subscription-manager-1.28.6-1.el8.x86_64 subscription-manager-rhsm-certificates-1.28.6-1.el8.x86_64 Complete! (reverse-i-search)`/': touch /var/lib/rhsm/cache^Content_access.json [root@dhcp-8-29-107 yum.repos.d]# rm /var/lib/rhsm/cache/content_access.json rm: remove regular empty file '/var/lib/rhsm/cache/content_access.json'? y [root@dhcp-8-29-107 yum.repos.d]# touch /var/lib/rhsm/cache/content_access.json [root@dhcp-8-29-107 yum.repos.d]# subscription-manager register Registering to: sat68:443/rhsm Username: admin Password: The system has been registered with ID: fcf6a60c-7e56-47f8-945a-d03cece7f3b8 The registered system name is: client >> No traceback, verified. 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 (subscription-manager 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-2021:1575 |
Description of problem: Customer scenario: /var/lib/rhsm/cache/content_access.json file is empty (due to whatever reason; optionally a malformed JSON content there). Then an attempt to register to Satellite6.7 fails with an uncaught json.decoder.JSONDecodeError exception. Registering to rhsm.redhat.com or to Satellite 6.6 works fine. Simply, Sat6.7 triggers the specific call flow that fetches some certs for locally missing serials. Version-Release number of selected component (if applicable): - subscription-manager-1.23.8-35.el8.x86_64 - any older version affected as well (also RHEL7, probably not worth to fix it there?) How reproducible: 100% Steps to Reproduce: 1. rm -f /var/lib/rhsm/cache/content_access.json touch /var/lib/rhsm/cache/content_access.json 2. register the system to Satelite6.7 by either way (via AK, via user/password, whatever) Actual results: The registration fails at the end with: Traceback (most recent call last): File "/usr/sbin/subscription-manager", line 11, in <module> load_entry_point('subscription-manager==1.23.8', 'console_scripts', 'subscription-manager')() File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 85, in main return managercli.ManagerCLI().main() File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2918, in main ret = CLI.main(self) File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main return cmd.main() File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 506, in main return_code = self._do_command() File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1400, in _do_command self.entcertlib.update() File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 32, in update self.report = self.locker.run(self._do_update) File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 18, in run return action() File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 42, in _do_update return action.perform() File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 141, in perform self.content_access_hook() File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 194, in content_access_hook update_data = self.content_access_cache.check_for_update() File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 685, in check_for_update data = json.loads(self.read()) File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) Expected results: No such uncaught exception. Additional info: The "json.loads(self.read())" should be wrapped in some catch block, I expect.