Bug 1443101 - register --force option , doesnot actually re-register when provided with --serverurl option
Summary: register --force option , doesnot actually re-register when provided with --s...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Kevin Howell
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-18 13:06 UTC by Shwetha Kallesh
Modified: 2017-08-01 19:22 UTC (History)
4 users (show)

Fixed In Version: subscription-manager-1.19.11-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 19:22:43 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github candlepin subscription-manager pull 1613 None closed 1443101: Provide feedback for force register 2020-04-24 11:41:59 UTC
Red Hat Bugzilla 1429657 None CLOSED subscription-manager unregisters before registering with --force 2019-04-15 17:41:52 UTC
Red Hat Product Errata RHBA-2017:2083 normal SHIPPED_LIVE python-rhsm and subscription-manager bug fix and enhancement update 2017-08-01 18:14:19 UTC

Internal Links: 1429657

Description Shwetha Kallesh 2017-04-18 13:06:20 UTC
Description of problem:

register --force option , doesnot actually re-register when provided with --serverurl option

Version-Release number of selected component (if applicable):
[root@cisco-b200m1-03 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.21-1
subscription management rules: 5.15.1
subscription-manager: 1.19.8-1.git.0.c0a0804.el7
python-rhsm: 1.19.5-1.git.0.c0a0804.el7


How reproducible:


Steps to Reproduce:
[root@cisco-b200m1-03 ~]# subscription-manager register --force
Registering to: Shwetha-candlepin.usersys.redhat.com:8443/candlepin
Username: admin
Password: 
Organization: admin
The system has been registered with ID: cc388e8c-2205-49c7-82ab-9601e0bb4618 
[root@cisco-b200m1-03 ~]# subscription-manager register --serverurl subscription.rhsm.stage.redhat.com:443/subscription
This system is already registered. Use --force to override
[root@cisco-b200m1-03 ~]# subscription-manager register --serverurl subscription.rhsm.stage.redhat.com:443/subscription --force
Invalid credentials.

Remove the consumer certs manually, and see that system is registered successfully
[root@cisco-b200m1-03 ~]# rm -rf /etc/pki/consumer/*

[root@cisco-b200m1-03 ~]# subscription-manager register --serverurl subscription.rhsm.stage.redhat.com:443/subscription --force
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: qa@redhat.com
Password: 
The system has been registered with ID: fc629706-9ed2-49fe-95c5-b1e7a08b3863

Actual results:
invalid credentials error

Expected results:
system should register successfully

Additional info:
2017-04-18 08:28:37,043 [INFO] subscription-manager:22216:MainThread @connection.py:520 - Response: status=200, requestUuid=1b2219f5-7dc1-449d-9c32-4a02b969329d, request="GET /candlepin/status"
2017-04-18 08:28:37,044 [INFO] subscription-manager:22216:MainThread @managercli.py:407 - Server Versions: {'rules-version': u'5.23', 'candlepin': u'2.1.0-1', 'server-type': 'Red Hat Subscription Management'}
2017-04-18 08:28:38,300 [INFO] subscription-manager:22216:MainThread @connection.py:520 - Response: status=200, requestUuid=6af34e86-2695-446f-8450-ea037e29bd3c, request="GET /candlepin/"
2017-04-18 08:28:38,301 [INFO] subscription-manager:22216:MainThread @cache.py:401 - Server does not support packages, skipping profile upload.
2017-04-18 08:28:39,567 [INFO] subscription-manager:22216:MainThread @connection.py:520 - Response: status=200, requestUuid=0dab470c-9382-49e3-9530-dde394f954a7, request="GET /candlepin/status"
2017-04-18 08:28:39,568 [INFO] subscription-manager:22216:MainThread @managercli.py:1230 - System registered, updating entitlements if needed
2017-04-18 08:28:40,953 [INFO] subscription-manager:22216:MainThread @connection.py:520 - Response: status=200, requestUuid=053bc9ae-df42-4a9a-9054-3a6275808f94, request="GET /candlepin/consumers/cc388e8c-2205-49c7-82ab-9601e0bb4618/certificates/serials"
2017-04-18 08:28:40,954 [INFO] subscription-manager:22216:MainThread @entcertlib.py:130 - certs updated:
Total updates: 0
Found (local) serial# []
Expected (UEP) serial# []
Added (new)
  <NONE>
Deleted (rogue):
  <NONE>
2017-04-18 08:28:42,308 [INFO] subscription-manager:22216:MainThread @connection.py:520 - Response: status=200, requestUuid=1f7a735b-2600-473a-ad81-001a5f983923, request="GET /candlepin/consumers/cc388e8c-2205-49c7-82ab-9601e0bb4618/compliance"
2017-04-18 08:28:42,312 [INFO] subscription-manager:22216:MainThread @cert_sorter.py:205 - Product status: valid_products= partial_products= expired_products= unentitled_producs=100000000000060, 1000000000000023, 100000000000011, 27060, 69, 5050, 5051, 917571, 1, 37069, 37068, 213412341237, 37065, 37067, 213412341234, 37062, 100000000000006, 100000000000005, 100000000000002, 100000000000003, 100000000000000, 100000000000001, 213412341236, 100000000000069, 98121, 213412341235, 100000000000020, 37080, 32060, 806, 88888, 900, 908, 37060, 37090, 37091, 801, 6051, 6050, and 37070 future_products= valid_until=None
2017-04-18 08:28:42,468 [INFO] rhsmd:21789:MainThread @connection.py:780 - Connection built: host=Shwetha-candlepin.usersys.redhat.com port=8443 handler=/candlepin auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2017-04-18 08:28:43,814 [INFO] rhsmd:21789:MainThread @connection.py:520 - Response: status=200, requestUuid=40abc0c2-fcd4-4fcb-885a-193ed0439750, request="GET /candlepin/consumers/cc388e8c-2205-49c7-82ab-9601e0bb4618/compliance"
2017-04-18 08:28:43,817 [INFO] rhsmd:21789:MainThread @cert_sorter.py:205 - Product status: valid_products= partial_products= expired_products= unentitled_producs=100000000000060, 1000000000000023, 100000000000011, 27060, 69, 5050, 5051, 917571, 1, 37069, 37068, 213412341237, 37065, 37067, 213412341234, 37062, 100000000000006, 100000000000005, 100000000000002, 100000000000003, 100000000000000, 100000000000001, 213412341236, 100000000000069, 98121, 213412341235, 100000000000020, 37080, 32060, 806, 88888, 900, 908, 37060, 37090, 37091, 801, 6051, 6050, and 37070 future_products= valid_until=None
2017-04-18 08:29:13,648 [INFO] rhsmd:22286:MainThread @rhsmd:263 - rhsmd started
2017-04-18 08:29:13,772 [INFO] subscription-manager:22280:MainThread @managercli.py:507 - X-Correlation-ID: 67c1d9f1b3c0419a869087127c649ea3
2017-04-18 08:29:13,772 [INFO] subscription-manager:22280:MainThread @managercli.py:396 - Client Versions: {'python-rhsm': '1.19.5-1.git.0.c0a0804.el7', 'subscription-manager': '1.19.8-1.git.0.c0a0804.el7'}
2017-04-18 08:29:13,773 [INFO] subscription-manager:22280:MainThread @connection.py:780 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2017-04-18 08:29:13,774 [INFO] subscription-manager:22280:MainThread @connection.py:780 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=none
2017-04-18 08:29:14,615 [INFO] subscription-manager:22280:MainThread @connection.py:520 - Response: status=200, requestUuid=ee13a5c0-825c-4e77-b1e5-62fbf1b64c16, request="GET /subscription/status/"
2017-04-18 08:29:14,616 [INFO] subscription-manager:22280:MainThread @managercli.py:396 - Client Versions: {'python-rhsm': '1.19.5-1.git.0.c0a0804.el7', 'subscription-manager': '1.19.8-1.git.0.c0a0804.el7'}
2017-04-18 08:29:14,635 [INFO] subscription-manager:22280:MainThread @managercli.py:371 - Consumer Identity name=cisco-b200m1-03.rhts.eng.bos.redhat.com uuid=cc388e8c-2205-49c7-82ab-9601e0bb4618
2017-04-18 08:29:20,403 [INFO] subscription-manager:22292:MainThread @managercli.py:507 - X-Correlation-ID: 93dde88bbc934131b067dfbc8f9b483c
2017-04-18 08:29:20,404 [INFO] subscription-manager:22292:MainThread @managercli.py:396 - Client Versions: {'python-rhsm': '1.19.5-1.git.0.c0a0804.el7', 'subscription-manager': '1.19.8-1.git.0.c0a0804.el7'}
2017-04-18 08:29:20,404 [INFO] subscription-manager:22292:MainThread @connection.py:780 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2017-04-18 08:29:20,405 [INFO] subscription-manager:22292:MainThread @connection.py:780 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=none
2017-04-18 08:29:20,982 [INFO] subscription-manager:22292:MainThread @connection.py:520 - Response: status=200, requestUuid=53b057bc-7b7e-4a34-a935-5962bbe81ba3, request="GET /subscription/status/"
2017-04-18 08:29:20,983 [INFO] subscription-manager:22292:MainThread @managercli.py:396 - Client Versions: {'python-rhsm': '1.19.5-1.git.0.c0a0804.el7', 'subscription-manager': '1.19.8-1.git.0.c0a0804.el7'}
2017-04-18 08:29:21,001 [INFO] subscription-manager:22292:MainThread @managercli.py:371 - Consumer Identity name=cisco-b200m1-03.rhts.eng.bos.redhat.com uuid=cc388e8c-2205-49c7-82ab-9601e0bb4618
2017-04-18 08:29:21,044 [INFO] subscription-manager:22292:MainThread @managercli.py:371 - Consumer Identity name=cisco-b200m1-03.rhts.eng.bos.redhat.com uuid=cc388e8c-2205-49c7-82ab-9601e0bb4618
2017-04-18 08:29:33,113 [INFO] subscription-manager:22292:MainThread @connection.py:520 - Response: status=401, request="DELETE /subscription/consumers/cc388e8c-2205-49c7-82ab-9601e0bb4618"
2017-04-18 08:29:33,114 [ERROR] subscription-manager:22292:MainThread @managercli.py:179 - exception caught in subscription-manager
2017-04-18 08:29:33,114 [ERROR] subscription-manager:22292:MainThread @managercli.py:180 - Invalid credentials.
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 89, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 80, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 2796, in main
    return CLI.main(self)
  File "/usr/lib/python2.7/site-packages/subscription_manager/cli.py", line 160, in main
    return cmd.main()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 551, in main
    return_code = self._do_command()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1115, in _do_command
    managerlib.unregister(self.cp, old_uuid)
  File "/usr/lib/python2.7/site-packages/subscription_manager/managerlib.py", line 802, in unregister
    uep.unregisterConsumer(consumer_uuid)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 1092, in unregisterConsumer
    return self.conn.request_delete(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 626, in request_delete
    return self._request("DELETE", method, params, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 640, in _request
    info=info, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 529, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 578, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: Invalid credentials.

Comment 2 Shwetha Kallesh 2017-04-18 13:09:24 UTC
Observe that it worked fine on rhel7.3 with following RHSM version , so adding keyword regression

[root@bkr-hv03-guest21 ~]# subscription-manager  version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.21-1
subscription management rules: 5.15.1
subscription-manager: 1.17.15-1.el7
python-rhsm: 1.17.9-1.el7


[root@bkr-hv03-guest21 ~]# subscription-manager  register --force --serverurl subscription.rhsm.stage.redhat.com
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: qa@redhat.com
Password: 
The system has been registered with ID: 08f1b990-eb01-400b-a36e-06ac574d749c 
  
[root@bkr-hv03-guest21 ~]# subscription-manager  register --force --serverurl Shwetha-candlepin.usersys.redhat.com:8443/candlepin
Registering to: Shwetha-candlepin.usersys.redhat.com:8443/candlepin
Username: admin
Password: 
Organization: admin

The system has been registered with ID: 7ad2ccbc-fa7b-4aea-a839-aae8028433c3 
[root@bkr-hv03-guest21 ~]# 
[root@bkr-hv03-guest21 ~]# subscription-manager  register --force --serverurl subscription.rhsm.stage.redhat.com:443/subscription
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: qa@redhat.com
Password: 
The system has been registered with ID: 439777f4-f8f1-4c04-8a77-9e119609b8b6

Comment 4 John Sefler 2017-04-18 16:03:26 UTC
Agreed! This is a Regression affecting many automated tests.

The last time this worked as expected was with...
subscription-manager-1.19.4-1.el7.x86_64

I suspect the commit 3b0586f9c15fa5fbb0291f6b50fa444b496a34a7 for Bug 1429657 might be the cause.

Comment 5 Kevin Howell 2017-04-26 17:48:40 UTC
Shwetha et al,

After some discussion with bcourt and jsefler, here is what we decided: the use case of switching from one entitlement server to another should be handled with two commands: unregister and then register. What we would like to change as part of this bug is making it clear what is happening with `register --force`, and especially, providing more details when a failure happens.

Pseudo-example:

Unregistering from: candlepin.example.com:8443/candlepin using identity {uuid}.
Unable to unregister: Invalid credentials.

Comment 7 Shwetha Kallesh 2017-05-03 06:19:27 UTC
[root@dhcp71-191 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.21-1
subscription management rules: 5.15.1
subscription-manager: 1.19.12-1.el7
python-rhsm: 1.19.6-1.el7


[root@dhcp71-191 ~]# subscription-manager register --force --serverurl subscription.rhsm.redhat.com
Unregistering from: subscription.rhsm.redhat.com:443/subscription
Invalid credentials.

Comment 8 errata-xmlrpc 2017-08-01 19:22:43 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, 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-2017:2083


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