Bug 1429657 - subscription-manager unregisters before registering with --force [NEEDINFO]
Summary: subscription-manager unregisters before registering with --force
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.3
Hardware: Unspecified
OS: Unspecified
high
low
Target Milestone: rc
: ---
Assignee: Kevin Howell
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: 1420851
TreeView+ depends on / blocked
 
Reported: 2017-03-06 19:18 UTC by Chris Duryee
Modified: 2020-09-10 10:17 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 19:21:47 UTC
Target Upstream Version:
khowell: needinfo? (cww)


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github candlepin subscription-manager pull 1559 'None' closed 1429657: Remove catch-all on register --force 2020-08-04 12:23:00 UTC
Red Hat Bugzilla 1443101 'high' 'CLOSED' 'register --force option , doesnot actually re-register when provided with --serverurl option' 2019-11-26 13:27:11 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: 1443101

Description Chris Duryee 2017-03-06 19:18:19 UTC
Description of problem:

If your candlepin server is down or is unreachable and you run "subscription-manager register --force", it will delete local data, then attempt to delete the remote record and re-regsiter.

This can cause issues when 'register --force' is scripted, since it can cause mass-unregisters to occur.

Comment 5 Barnaby Court 2017-03-09 15:23:14 UTC
The change requested here is to have the command fail immediately, and leave the existing identity in place, if the request to unregister from Candlepin fails due to a connection error. It is acceptable for the unregister request to candlepin to fail for any reason other than unable to connect.

Comment 7 Shwetha Kallesh 2017-04-06 16:55:16 UTC
When network is down on server , subscription-manager register --force doesnot unregister, so moving bug to verified

[root@dhcp70-137 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: Unknown
subscription management rules: Unknown
subscription-manager: 1.19.4-1.el7
python-rhsm: 1.19.2-1.el7

[root@dhcp70-137 ~]# subscription-manager register --force
The system with UUID 2b26d757-23de-4ff0-a1b0-ff44908352d1 has been unregistered
Registering to: Shwetha-candlepin.usersys.redhat.com:8443/candlepin
Username: admin
Password: 
Organization: admin
The system has been registered with ID: 1021d1e1-384c-4eb1-b05f-880d40d90ee6 

Stop network on the server


[root@dhcp70-137 ~]# subscription-manager register --force
Registering to: Shwetha-candlepin.usersys.redhat.com:8443/candlepin
Username: admin
Password: 
Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information.

[root@dhcp70-137 ~]# tail -f /var/log/rhsm/rhsm.log 
2017-04-06 12:46:35,718 [ERROR] subscription-manager:19565:MainThread @managercli.py:1114 - Unable to unregister consumer: 1021d1e1-384c-4eb1-b05f-880d40d90ee6
2017-04-06 12:46:35,719 [ERROR] subscription-manager:19565:MainThread @managercli.py:1115 - [Errno 110] Connection timed out
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1108, 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 1075, in unregisterConsumer
    return self.conn.request_delete(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 615, in request_delete
    return self._request("DELETE", method, params, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 629, in _request
    info=info, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 485, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python2.7/httplib.py", line 1017, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1051, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/httplib.py", line 1013, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 864, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.7/httplib.py", line 826, in send
    self.connect()
  File "/usr/lib64/python2.7/httplib.py", line 1227, in connect
    HTTPConnection.connect(self)
  File "/usr/lib64/python2.7/httplib.py", line 807, in connect
    self.timeout, self.source_address)
  File "/usr/lib64/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 110] Connection timed out
2017-04-06 12:47:28,822 [INFO] subscription-manager:19565:MainThread @connection.py:763 - Connection built: host=Shwetha-candlepin.usersys.redhat.com port=8443 handler=/candlepin auth=basic username=admin
2017-04-06 12:49:36,707 [ERROR] subscription-manager:19565:MainThread @managercli.py:179 - Error during registration: [Errno 110] Connection timed out
2017-04-06 12:49:36,708 [ERROR] subscription-manager:19565:MainThread @managercli.py:180 - [Errno 110] Connection timed out
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1156, in _do_command
    owner_key = self._determine_owner_key(admin_cp)
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1308, in _determine_owner_key
    owners = cp.getOwnerList(self.username)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 1059, in getOwnerList
    return self.conn.request_get(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 603, in request_get
    return self._request("GET", method, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 629, in _request
    info=info, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 485, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python2.7/httplib.py", line 1017, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1051, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/httplib.py", line 1013, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 864, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.7/httplib.py", line 826, in send
    self.connect()
  File "/usr/lib64/python2.7/httplib.py", line 1227, in connect
    HTTPConnection.connect(self)
  File "/usr/lib64/python2.7/httplib.py", line 807, in connect
    self.timeout, self.source_address)
  File "/usr/lib64/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 110] Connection timed out

Comment 9 errata-xmlrpc 2017-08-01 19:21:47 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.