Linux – subscription-manager fails with error “‘NoneType’ object has no attribute ‘__getitem__'”

centoscentos7linuxredhat

when i want to register my redhat machine . i get this type of error.

[root@client ~]# subscription-manager register 
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: saiful31
Password: 
'NoneType' object has no attribute '__getitem__'

rhsm.log:-

[root@client ~]# tail -f /var/log/rhsm/rhsm.log
2020-10-22 17:15:32,891 [INFO] subscription-manager:3335:MainThread @connection.py:905 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=none
2020-10-22 17:15:42,418 [INFO] subscription-manager:3335:MainThread @connection.py:905 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=basic username=saiful31
2020-10-22 17:15:45,685 [ERROR] subscription-manager:3335:MainThread @managercli.py:215 - Error during registration: 'NoneType' object has no attribute '__getitem__'
2020-10-22 17:15:45,685 [ERROR] subscription-manager:3335:MainThread @managercli.py:216 - 'NoneType' object has no attribute '__getitem__'
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1353, in _do_command
    owner_key = self._determine_owner_key(admin_cp)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1506, in _determine_owner_key
    return owners[0]['key']
TypeError: 'NoneType' object has no attribute '__getitem__'

what can i do now ??

Best Answer

I solved it in my case with:

sudo subscription-manager clean

then registering again

RHEL 7.9