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.

Bug 1429657

Summary: subscription-manager unregisters before registering with --force
Product: Red Hat Enterprise Linux 7 Reporter: Chris Duryee <cduryee>
Component: subscription-managerAssignee: Kevin Howell <khowell>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: low Docs Contact:
Priority: high    
Version: 7.3CC: bcourt, cww, khowell, redakkan, skallesh
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 19:21:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1420851    

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

Comment 10 Red Hat Bugzilla 2023-09-14 03:54:52 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days