RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2020248 - AttributeError: 'dict' object has no attribute 'result'
Summary: AttributeError: 'dict' object has no attribute 'result'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: subscription-manager
Version: 9.0
Hardware: Unspecified
OS: Unspecified
high
low
Target Milestone: rc
: 9.0
Assignee: Pino Toscano
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks: 2020284
TreeView+ depends on / blocked
 
Reported: 2021-11-04 12:56 UTC by John Sefler
Modified: 2022-05-17 16:29 UTC (History)
3 users (show)

Fixed In Version: subscription-manager-1.29.21-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2020284 (view as bug list)
Environment:
Last Closed: 2022-05-17 15:58:12 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin subscription-manager pull 2873 0 None Merged 2020248: handle server-side consumer deletion in syspurpose commands 2021-11-15 06:10:33 UTC
Red Hat Issue Tracker ENT-4505 0 None None None 2021-11-08 14:04:45 UTC
Red Hat Issue Tracker RHELPLAN-101749 0 None None None 2021-11-04 12:57:11 UTC
Red Hat Product Errata RHBA-2022:3984 0 None None None 2022-05-17 15:58:22 UTC

Description John Sefler 2021-11-04 12:56:09 UTC
Description of problem:
An automated gating test revealed the following regression against a CI build of subscription-manager from the main branch.

The scenario is that a registered consumer is deleted from the server-side and the test is checking various module behavior when a Gone exception is encountered.

Here is the command line output from a call to "subscription-manager service-level":

# subscription-manager service-level
Stdout:
Stderr: 'dict' object has no attribute 'result'
ExitCode: 70

Here is the last request from /var/log/rhsm/rhsm.log:
2021-11-04 08:54:25,091 [DEBUG] subscription-manager:3664776:MainThread @connection.py:717 - Making request: GET /candlepin/consumers/6fa4ef85-dfbb-4469-8fd5-231f3c746a5b
2021-11-04 08:54:25,097 [DEBUG] subscription-manager:3664776:MainThread @connection.py:571 - Loaded CA certificates from /etc/rhsm/ca/: rhsm-auto9-gate-candlepin.pem, redhat-entitlement-authority.pem, redhat-uep.pem
2021-11-04 08:54:25,143 [DEBUG] subscription-manager:3664776:MainThread @connection.py:810 - Response time: 0.03223276138305664, Smoothed response time: 0.029261302947998048
2021-11-04 08:54:25,143 [DEBUG] subscription-manager:3664776:MainThread @connection.py:787 - Response: status=410, requestUuid=17e082ce-c2df-41ae-8902-9b4407635db2, request="GET /candlepin/consumers/6fa4ef85-dfbb-4469-8fd5-231f3c746a5b"
2021-11-04 08:54:25,144 [DEBUG] subscription-manager:3664776:MainThread @syspurposelib.py:267 - Syspurpose updated: Syspurpose Sync
        status: Failed to sync system purpose
        updates: 
        exceptions: Unable to sync syspurpose with server: HTTP error (410 - Gone): Unit 6fa4ef85-dfbb-4469-8fd5-231f3c746a5b has been deleted

        
2021-11-04 08:54:25,145 [ERROR] subscription-manager:3664776:MainThread @cli.py:61 - exception caught in subscription-manager
2021-11-04 08:54:25,145 [ERROR] subscription-manager:3664776:MainThread @cli.py:62 - 'dict' object has no attribute 'result'
Traceback (most recent call last):
  File "/usr/lib64/python3.9/site-packages/subscription_manager/cli_command/cli.py", line 368, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.9/site-packages/subscription_manager/cli_command/service_level.py", line 128, in _do_command
    self.show()
  File "/usr/lib64/python3.9/site-packages/subscription_manager/cli_command/service_level.py", line 170, in show
    super(ServiceLevelCommand, self).show()
  File "/usr/lib64/python3.9/site-packages/subscription_manager/cli_command/abstract_syspurpose.py", line 344, in show
    syspurpose = self.sync().result
AttributeError: 'dict' object has no attribute 'result'



Version-Release number of selected component (if applicable):
[root@rhsm-auto90-client1 ~]# rpm -q subscription-manager
subscription-manager-1.29.19-1.git.102.93c5be7.el9.x86_64


How reproducible:


Steps to Reproduce:
1. register a RHEL client using subscription-manager to the customer portal
2. used the customer portal rhsm app to delete the consumer from the server-side
3. on the RHEL client, run "subscription-manager service-level"
OR
[root@rhsm-auto9-gate-rhel ~]# subscription-manager register --username=testuser1 --org admin
Registering to: rhsm-auto9-gate-candlepin.usersys.redhat.com:8443/candlepin
Password: 
The system has been registered with ID: d75e6145-b8a0-44fd-b380-fe00924c2324
The registered system name is: rhsm-auto9-gate-rhel.usersys.redhat.com
[root@rhsm-auto9-gate-rhel ~]# 
[root@rhsm-auto9-gate-rhel ~]# curl --stderr /dev/null --insecure --user testuser1:REDACTED --request DELETE https://rhsm-auto9-gate-candlepin.usersys.redhat.com:8443/candlepin/consumers/d75e6145-b8a0-44fd-b380-fe00924c2324
[root@rhsm-auto9-gate-rhel ~]# 
[root@rhsm-auto9-gate-rhel ~]# subscription-manager identity
Consumer profile "d75e6145-b8a0-44fd-b380-fe00924c2324" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@rhsm-auto9-gate-rhel ~]# 
[root@rhsm-auto9-gate-rhel ~]# subscription-manager service-level
'dict' object has no attribute 'result'
[root@rhsm-auto9-gate-rhel ~]# subscription-manager role
'dict' object has no attribute 'result'
[root@rhsm-auto9-gate-rhel ~]# subscription-manager addons
'dict' object has no attribute 'result'
[root@rhsm-auto9-gate-rhel ~]# subscription-manager usage
'dict' object has no attribute 'result'
[root@rhsm-auto9-gate-rhel ~]# 
[root@rhsm-auto9-gate-rhel ~]# subscription-manager syspurpose
Consumer profile "d75e6145-b8a0-44fd-b380-fe00924c2324" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@rhsm-auto9-gate-rhel ~]# 


Actual results:
'dict' object has no attribute 'result'

Expected results:
Consumer profile "d75e6145-b8a0-44fd-b380-fe00924c2324" has been deleted from the server. You can use command clean or unregister to remove local profile.

Additional info:

Comment 1 John Sefler 2021-11-04 13:58:50 UTC
There is also a failure on RHEL8.6 (for modules role, usage, addons, but NOT service-level)...

[root@kvm-07-guest13 ~]# rpm -q subscription-manager
subscription-manager-1.28.22-1.git.0.5118d85.el8.x86_64

[root@kvm-07-guest13 ~]# subscription-manager register --username=testuser1 --org admin
Registering to: rhsm-auto90-candlepin.usersys.redhat.com:8443/candlepin
Password: 
The system has been registered with ID: cd7f40c3-5b59-40bb-8253-2f1a3a51f2fb
The registered system name is: kvm-07-guest13.hv2.lab.eng.bos.redhat.com
[root@kvm-07-guest13 ~]# 
[root@kvm-07-guest13 ~]# curl --stderr /dev/null --insecure --user testuser1:REDACTED --request DELETE https://rhsm-auto90-candlepin.usersys.redhat.com:8443/candlepin/consumers/cd7f40c3-5b59-40bb-8253-2f1a3a51f2fb
[root@kvm-07-guest13 ~]# 
[root@kvm-07-guest13 ~]# subscription-manager service-level
Consumer profile "cd7f40c3-5b59-40bb-8253-2f1a3a51f2fb" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@kvm-07-guest13 ~]# 
[root@kvm-07-guest13 ~]# subscription-manager role
'dict' object has no attribute 'result'             <============= FAIL
[root@kvm-07-guest13 ~]# 
[root@kvm-07-guest13 ~]# subscription-manager usage
'dict' object has no attribute 'result'             <============= FAIL
[root@kvm-07-guest13 ~]# 
[root@kvm-07-guest13 ~]# subscription-manager addons
'dict' object has no attribute 'result'             <============= FAIL
[root@kvm-07-guest13 ~]# 
[root@kvm-07-guest13 ~]# subscription-manager syspurpose
Consumer profile "cd7f40c3-5b59-40bb-8253-2f1a3a51f2fb" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@kvm-07-guest13 ~]#

Comment 2 John Sefler 2021-11-04 14:10:29 UTC
Failure is also happening against with the syspurpose submodules...

[root@kvm-07-guest13 ~]# subscription-manager syspurpose role
'dict' object has no attribute 'result'

Comment 3 Archana Pandey 2021-11-18 08:44:13 UTC
Pre-verification

Re-producing issue on RHEL 9 subscription-manager-1.29.18-2.el9.x86_64

[root@auto-hv-01-guest04 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.21-1
subscription management rules: 5.41
subscription-manager: 1.29.18-2.el9
[root@auto-hv-01-guest04 ~]# rpm -qa subscription-manager
subscription-manager-1.29.18-2.el9.x86_64
[root@auto-hv-01-guest04 ~]# 

[root@auto-hv-01-guest04 ~]# subscription-manager register --username rhel9-stackablePool --password *********
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
The system has been registered with ID: 0c12e8ae-aa9f-433f-9c09-72af6dd54ed7
The registered system name is: auto-hv-01-guest04.idmqe.lab.eng.bos.redhat.com
[root@auto-hv-01-guest04 ~]# vim /etc/rhsm/rhsm.conf
[root@auto-hv-01-guest04 ~]# curl --stderr /dev/null --insecure --user rhel9-stackablePool:****** --request DELETE https://subscription.rhsm.stage.redhat.com/candlepin/consumers/0c12e8ae-aa9f-433f-9c09-72af6dd54ed7
[root@auto-hv-01-guest04 ~]# subscription-manager identity
Consumer profile "0c12e8ae-aa9f-433f-9c09-72af6dd54ed7" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# subscription-manager service-level
Consumer profile "0c12e8ae-aa9f-433f-9c09-72af6dd54ed7" has been deleted from the server. You can use command clean or unregister to remove local profile.

[root@auto-hv-01-guest04 ~]# subscription-manager role
'dict' object has no attribute 'result'                     <<<< FAIL
[root@auto-hv-01-guest04 ~]# subscription-manager addons
'dict' object has no attribute 'result'                     <<<< FAIL
[root@auto-hv-01-guest04 ~]# subscription-manager usage
'dict' object has no attribute 'result'                     <<<< FAIL
[root@auto-hv-01-guest04 ~]# subscription-manager syspurpose
Consumer profile "0c12e8ae-aa9f-433f-9c09-72af6dd54ed7" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# subscription-manager syspurpose  role
'dict' object has no attribute 'result'                             <<<< FAIL
[root@auto-hv-01-guest04 ~]# subscription-manager syspurpose  usage
'dict' object has no attribute 'result'                             <<<< FAIL
[root@auto-hv-01-guest04 ~]# subscription-manager syspurpose  addons
'dict' object has no attribute 'result'                             <<<< FAIL
[root@auto-hv-01-guest04 ~]# 


===================================================================================================

Pre-verifying on subscription-manager-1.29.21-1.el9.x86_64

[root@auto-hv-01-guest04 ~]# rpm -qa subscription-manager
subscription-manager-1.29.21-1.el9.x86_64
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# rpm -qa --changelog | grep 2020248
- 2020248: handle server-side consumer deletion in syspurpose commands
- 2020248: handle server-side consumer deletion in syspurpose commands
- 2020248: handle server-side consumer deletion in syspurpose commands
- 2020248: handle server-side consumer deletion in syspurpose commands
- 2020248: handle server-side consumer deletion in syspurpose commands
[root@auto-hv-01-guest04 ~]# 

[root@auto-hv-01-guest04 ~]# subscription-manager register --username rhel9-stackablePool --password redhat@123
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
The system has been registered with ID: 197e611d-06a7-43bc-bc31-5ad2d037d5ff
The registered system name is: auto-hv-01-guest04.idmqe.lab.eng.bos.redhat.com
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# curl --stderr /dev/null --insecure --user rhel9-stackablePool:redhat@123 --request DELETE https://subscription.rhsm.stage.redhat.com/candlepin/consumers/197e611d-06a7-43bc-bc31-5ad2d037d5ff
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# subscription-manager identity
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# subscription-manager service-level 
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# subscription-manager role
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# subscription-manager usage
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# subscription-manager addons
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# subscription-manager syspurpose role
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# subscription-manager usage
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# subscription-manager syspurpose usage
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# subscription-manager syspurpose addons
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# subscription-manager syspurpose service-level
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]# 
[root@auto-hv-01-guest04 ~]# subscription-manager syspurpose 
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.
[root@auto-hv-01-guest04 ~]#


Actual results:
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.


Expected results:
Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server. You can use command clean or unregister to remove local profile.


Additional info:

Rhsm.log:
2021-11-18 03:18:00,287 [INFO] subscription-manager:99766:MainThread @entcertlib.py:129 - certs updated:
Total updates: 0
Found (local) serial# []
Expected (UEP) serial# []
Added (new)
  <NONE>
Deleted (rogue):
  <NONE>
2021-11-18 03:18:43,433 [WARNING] subscription-manager:99939:MainThread @cache.py:919 - Unable to get data for <class 'subscription_manager.cache.CurrentOwnerCache'> using REST API: HTTP error (410 - Gone): Unit 197e611d-06a7-43bc-bc31-5ad2d037d5ff has been deleted
2021-11-18 03:18:43,434 [CRITICAL] subscription-manager:99939:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.
2021-11-18 03:18:50,701 [CRITICAL] subscription-manager:99945:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.
2021-11-18 03:18:56,163 [CRITICAL] subscription-manager:99948:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.
2021-11-18 03:19:03,622 [CRITICAL] subscription-manager:99951:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.
2021-11-18 03:19:11,278 [CRITICAL] subscription-manager:99956:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.
2021-11-18 03:20:12,724 [CRITICAL] subscription-manager:99983:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.
2021-11-18 03:20:21,204 [CRITICAL] subscription-manager:99988:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.
2021-11-18 03:20:30,408 [CRITICAL] subscription-manager:99994:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.
2021-11-18 03:20:39,483 [CRITICAL] subscription-manager:99998:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.
2021-11-18 03:21:23,864 [CRITICAL] subscription-manager:100018:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.
2021-11-18 03:21:52,357 [CRITICAL] subscription-manager:100032:MainThread @cli.py:355 - Consumer profile "197e611d-06a7-43bc-bc31-5ad2d037d5ff" has been deleted from the server.


Verification: PASSED

Comment 8 Rehana 2021-11-29 10:29:25 UTC
Verifying on :
=============
# subscription-manager version ; rpm -qa subscription-manager --changelog | grep 2020248
server type: This system is currently not registered.
subscription management server: 4.1.0-1
subscription management rules: 5.41
subscription-manager: 1.29.21-1.el9

- 2020248: handle server-side consumer deletion in syspurpose commands

# subscription-manager register --username=testuser1 --org admin
Registering to: ip:8443/candlepin
Password: 
The system has been registered with ID: e9cbe063-108d-4a99-98fc-dfb2d1847f7b
The registered system name is: *******

# curl --stderr /dev/null --insecure --user testuser1:***** --request DELETE https://ip:8443/candlepin/consumers/e9cbe063-108d-4a99-98fc-dfb2d1847f7b

# subscription-manager service-level
Consumer profile "e9cbe063-108d-4a99-98fc-dfb2d1847f7b" has been deleted from the server. You can use command clean or unregister to remove local profile.

# subscription-manager role
Consumer profile "e9cbe063-108d-4a99-98fc-dfb2d1847f7b" has been deleted from the server. You can use command clean or unregister to remove local profile.

# subscription-manager usage
Consumer profile "e9cbe063-108d-4a99-98fc-dfb2d1847f7b" has been deleted from the server. You can use command clean or unregister to remove local profile.

# subscription-manager addons
Consumer profile "e9cbe063-108d-4a99-98fc-dfb2d1847f7b" has been deleted from the server. You can use command clean or unregister to remove local profile.

# subscription-manager syspurpose
Consumer profile "e9cbe063-108d-4a99-98fc-dfb2d1847f7b" has been deleted from the server. You can use command clean or unregister to remove local profile.

# subscription-manager syspurpose
Consumer profile "e9cbe063-108d-4a99-98fc-dfb2d1847f7b" has been deleted from the server. You can use command clean or unregister to remove local profile.

# subscription-manager syspurpose role
Consumer profile "e9cbe063-108d-4a99-98fc-dfb2d1847f7b" has been deleted from the server. You can use command clean or unregister to remove local profile.

# subscription-manager syspurpose usage
Consumer profile "e9cbe063-108d-4a99-98fc-dfb2d1847f7b" has been deleted from the server. You can use command clean or unregister to remove local profile.

# subscription-manager syspurpose service-level
Consumer profile "e9cbe063-108d-4a99-98fc-dfb2d1847f7b" has been deleted from the server. You can use command clean or unregister to remove local profile.

# subscription-manager syspurpose addons
Consumer profile "e9cbe063-108d-4a99-98fc-dfb2d1847f7b" has been deleted from the server. You can use command clean or unregister to remove local profile.

All the above scenarios are now PASSing when a consumer is deleted from the server side . Hence moving the bug to verified!!

Comment 10 errata-xmlrpc 2022-05-17 15:58:12 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 (new packages: subscription-manager), 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:3984


Note You need to log in before you can comment on or make changes to this bug.