Bug 2189664
| Summary: | subscription-manager status throws a... 'NoneType' object has no attribute 'get' after configuring a bad proxy | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | John Sefler <jsefler> |
| Component: | subscription-manager | Assignee: | Pino Toscano <ptoscano> |
| Status: | CLOSED ERRATA | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 9.3 | Keywords: | AutoVerified, Regression, Triaged |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | 9.3 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | subscription-manager-1.29.35-1.el9 | Doc Type: | No Doc Update |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-11-07 08:51:53 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: | |||
For comparison, the same scenario on RHEL-9.2 follows with more graceful error handling... [root@kvm-03-guest21 ~]# rpm -q subscription-manager subscription-manager-1.29.33.1-1.el9_2.x86_64 [root@kvm-03-guest21 ~]# subscription-manager register --username=stage_rhsmqe_testuser01 Registering to: subscription.rhsm.stage.redhat.com:443/subscription Password: The system has been registered with ID: f7dfc179-6e01-4fc4-93a8-7081df9866c5 The registered system name is: kvm-03-guest21.lab.eng.rdu2.redhat.com [root@kvm-03-guest21 ~]# [root@kvm-03-guest21 ~]# subscription-manager config --server.proxy_hostname=bad-proxy --server.proxy_port=3127 [root@kvm-03-guest21 ~]# [root@kvm-03-guest21 ~]# subscription-manager status +-------------------------------------------+ System Status Details +-------------------------------------------+ Overall Status: Invalid Red Hat Enterprise Linux for x86_64: - Not supported by a valid subscription. System Purpose Status: Unknown [root@kvm-03-guest21 ~]# echo $? 1 [root@kvm-03-guest21 ~]# [root@kvm-03-guest21 ~]# tail -6 /var/log/rhsm/rhsm.log 2023-04-25 16:34:06,233 [ERROR] subscription-manager:21132:MainThread @cache.py:245 - Proxy error at bad-proxy:3127: [Errno -2] Name or service not known 2023-04-25 16:34:06,233 [WARNING] subscription-manager:21132:MainThread @cache.py:251 - Unable to reach server, using cached status. 2023-04-25 16:34:06,384 [ERROR] subscription-manager:21132:MainThread @cache.py:245 - Proxy error at bad-proxy:3127: [Errno -2] Name or service not known 2023-04-25 16:34:06,385 [WARNING] subscription-manager:21132:MainThread @cache.py:251 - Unable to reach server, using cached status. 2023-04-25 16:34:06,840 [ERROR] subscription-manager:21132:MainThread @cache.py:245 - Proxy error at bad-proxy:3127: [Errno -2] Name or service not known 2023-04-25 16:34:06,840 [ERROR] subscription-manager:21132:MainThread @cache.py:248 - Server unreachable, registered, but no cache exists. [root@kvm-03-guest21 ~]# Reproduced easily (though I really needed to change the config, rather than pass --proxy to 'sub-man status'), thanks. This is a small regression introduced by the recent internal cache rework (part of [1]); nothing bad in the end, simply a lack of tests (sigh), hopefully easily fixed by: https://github.com/candlepin/subscription-manager/pull/3252 [1] https://github.com/candlepin/subscription-manager/pull/3225 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-2023:6606 |
Description of problem: After setting a bad proxy on a registered system, a call to subscription-manager status encounters "'NoneType' object has no attribute 'get'". This was handled more gracefully on RHEL-9.2 Version-Release number of selected component (if applicable): [root@kvm-02-guest13 ~]# rpm -q subscription-manager subscription-manager-1.29.34-1.el9.x86_64 How reproducible: Steps to Reproduce: [root@kvm-02-guest13 ~]# subscription-manager register --username=stage_rhsmqe_testuser01 Registering to: subscription.rhsm.stage.redhat.com:443/subscription Password: The system has been registered with ID: 2e081dce-45e3-4023-9a40-0f81c5ed7034 The registered system name is: kvm-02-guest13.lab.eng.rdu2.redhat.com [root@kvm-02-guest13 ~]# [root@kvm-02-guest13 ~]# subscription-manager config --server.proxy_hostname=bad-proxy --server.proxy_port=3127 [root@kvm-02-guest13 ~]# [root@kvm-02-guest13 ~]# subscription-manager status +-------------------------------------------+ System Status Details +-------------------------------------------+ Overall Status: Invalid Red Hat Enterprise Linux for x86_64 Beta: - Not supported by a valid subscription. System Purpose Status: Unknown 'NoneType' object has no attribute 'get' [root@kvm-02-guest13 ~]# echo $? 70 Actual results: above Expected results: exitCode 1 (without the 'NoneType' object error) Additional info: root@kvm-02-guest13 ~]# tail -25 /var/log/rhsm/rhsm.log 2023-04-25 16:30:34,568 [DEBUG] subscription-manager:163597:MainThread @connection.py:1117 - Making request: GET /subscription/status 2023-04-25 16:30:34,569 [DEBUG] subscription-manager:163597:MainThread @connection.py:756 - Creating new connection 2023-04-25 16:30:34,570 [DEBUG] subscription-manager:163597:MainThread @connection.py:726 - Loaded CA certificates from /etc/rhsm/ca/: redhat-entitlement-authority.pem, redhat-uep.pem 2023-04-25 16:30:34,571 [DEBUG] subscription-manager:163597:MainThread @connection.py:781 - Using proxy: bad-proxy:3127 2023-04-25 16:30:34,722 [DEBUG] subscription-manager:163597:MainThread @files.py:296 - Failed to detect whether the server has syspurpose capability: Proxy error at bad-proxy:3127: [Errno -2] Name or service not known 2023-04-25 16:30:34,722 [DEBUG] subscription-manager:163597:MainThread @files.py:651 - Successfully updated syspurpose values at '/etc/rhsm/syspurpose/syspurpose.json'. 2023-04-25 16:30:34,722 [DEBUG] subscription-manager:163597:MainThread @files.py:652 - Failed to update syspurpose values at '/etc/rhsm/syspurpose/syspurpose.json'. 2023-04-25 16:30:34,723 [DEBUG] subscription-manager:163597:MainThread @connection.py:1117 - Making request: GET /subscription/status 2023-04-25 16:30:34,723 [DEBUG] subscription-manager:163597:MainThread @connection.py:756 - Creating new connection 2023-04-25 16:30:34,724 [DEBUG] subscription-manager:163597:MainThread @connection.py:726 - Loaded CA certificates from /etc/rhsm/ca/: redhat-entitlement-authority.pem, redhat-uep.pem 2023-04-25 16:30:34,725 [DEBUG] subscription-manager:163597:MainThread @connection.py:781 - Using proxy: bad-proxy:3127 2023-04-25 16:30:34,876 [ERROR] subscription-manager:163597:MainThread @cache.py:260 - Proxy error at bad-proxy:3127: [Errno -2] Name or service not known 2023-04-25 16:30:34,876 [ERROR] subscription-manager:163597:MainThread @cache.py:263 - Server unreachable, registered, but no cache exists. 2023-04-25 16:30:34,876 [ERROR] subscription-manager:163597:MainThread @cli.py:71 - exception caught in subscription-manager 2023-04-25 16:30:34,877 [ERROR] subscription-manager:163597:MainThread @cli.py:72 - 'NoneType' object has no attribute 'get' Traceback (most recent call last): File "/usr/lib64/python3.9/site-packages/subscription_manager/cli_command/cli.py", line 412, in main return_code = self._do_command() File "/usr/lib64/python3.9/site-packages/subscription_manager/cli_command/status.py", line 169, in _do_command self._print_syspurpose_status(on_date) File "/usr/lib64/python3.9/site-packages/subscription_manager/cli_command/status.py", line 147, in _print_syspurpose_status syspurpose_status_code = syspurpose_cache.get_overall_status_code() File "/usr/lib64/python3.9/site-packages/subscription_manager/cache.py", line 397, in get_overall_status_code return self.server_status.get("status", "unknown") AttributeError: 'NoneType' object has no attribute 'get'