Red Hat Bugzilla – 2160482 – subscription-manager registration using access token fails with 'Restlib' object has no attribute 'close_connestion' error
Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
Description of problem:
In RHEL 9.1, When we try to register a system using access token (generated using offline API token), it results in below error.
----------------------------
[root@xxxx ~]# subscription-manager register --token=$(curl https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -d grant_type=refresh_token -d client_id=rhsm-api -d refresh_token=$TOKEN | jq --raw-output .access_token)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3467 100 2731 100 736 11192 3016 --:--:-- --:--:-- --:--:-- 14151
'Restlib' object has no attribute 'close_connestion'
[root@xxxxx ~]# more /etc/redhat-release
Red Hat Enterprise Linux release 9.1 (Plow)
---------------------------
But, a system profile gets created on Portal and the status of the system profile on portal shows as 'Disconnected or never checked-in'.
Version-Release number of selected component (if applicable):
RHEL 9.1
subscription-manager-rhsm-certificates-20220623-1.el9.noarch
libdnf-plugin-subscription-manager-1.29.30-1.el9.x86_64
python3-subscription-manager-rhsm-1.29.30-1.el9.x86_64
subscription-manager-1.29.30-1.el9.x86_64
Subscription-manager-cockpit-4-1.el9.noarch
How reproducible:
Easy
Steps to Reproduce:
1. Generate an offline token as from API Tokens page(https://access.redhat.com/management/api)
2. Use the offline token to generate an online access token as specified in article: https://access.redhat.com/articles/3626371
3. Use the generate online access token to register the RHEL 9.1 system using subscription-manager command.
# subscription-manager --token=ACCESS_TOKEN
OR You can run below register command and copy the offline token into refresh_token parameter in below command.
subscription-manager register --token=$(curl https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -d grant_type=refresh_token -d client_id=rhsm-api -d refresh_token="eyJh.." | jq --raw-output .access_token)
Actual results:
# subscription-manager register --token=$(curl https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -d grant_type=refresh_token -d client_id=rhsm-api -d refresh_token="eyJh.." | jq --raw-output .access_token)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3562 100 2823 100 739 5726 1498 --:--:-- --:--:-- --:--:-- 7225
'Restlib' object has no attribute 'close_connestion'
[root@xxx xxxxx]# subscription-manager identity
This system is not yet registered. Try 'subscription-manager register --help' for more information.
[root@xxx xx]#
Expected results:
We expect the registration to be successful.
Additional info:
We tested the same on RHEL 8.7 and RHEL 9.0 versions and the registration is successful. Below is the registration data from RHEL 9.0 version.
[root@xxxxxx ~]# rpm -qa | grep -i subscription-manager
subscription-manager-rhsm-certificates-1.29.26.1-1.el9_0.x86_64
libdnf-plugin-subscription-manager-1.29.26.1-1.el9_0.x86_64
python3-subscription-manager-rhsm-1.29.26.1-1.el9_0.x86_64
subscription-manager-1.29.26.1-1.el9_0.x86_64
subscription-manager-cockpit-1.29.26.1-1.el9_0.noarch
[root@xxxxxx ~]#
[root@xxxxxxx ~]# subscription-manager clean
All local data removed
[root@xxxxxxx ~]# subscription-manager register --token=$(curl https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -d grant_type=refresh_token -d client_id=rhsm-api -d refresh_token="eyJhb..." | jq --raw-output .access_token)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3562 100 2823 100 739 3256 852 --:--:-- --:--:-- --:--:-- 4103
The system has been registered with ID: xxxx-xxxxx-xxx-xxxxxxxxx
The registered system name is: xxxxxxx
[root@xxxxxxx ~]#
Please do let us know if additional info is required.
Thanks