Bug 1323050

Summary: Failed to unregister system as Runtime Error
Product: [Retired] Subscription Asset Manager Reporter: Liushihui <shihliu>
Component: candlepinAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED WONTFIX QA Contact: SAM QE List <sam-qe-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.4.1CC: hsun, ldai, qianzhan, sgao
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-26 20:33:23 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:
Attachments:
Description Flags
rhsm.log none

Description Liushihui 2016-04-01 06:05:12 UTC
Description of problem:
Failed to unregister system to SAM as "Runtime Error ERROR: update or delete on table "cp_pool" violates foreign key constraint "fk_entitlement_pool" on table "cp_entitlement""

Version-Release number of selected component (if applicable):
SAM-1.4.1-RHEL-6-20141113.0
virt-who-0.16-7.el6.noarch
subscription-manager-1.16.8-8.el6.x86_64
python-rhsm-1.16.6-1.el6.x86_64

How reproducible:
10%

Steps to Reproduce:
1. Register system to SAM1.4.1
2. Subscribe a physical pool "Resilient Storage for Unlimited Guests"
# subscription-manager subscribe --pool=2c90ec8c53c9b0500153c9b2019a0282
Successfully attached a subscription for: Resilient Storage for Unlimited Guests
1 local certificate has been deleted.
3. Unregister system and check rhsm log, please see detail rhsm log in attachment.
# subscription-manager unregister
Runtime Error ERROR: update or delete on table "cp_pool" violates foreign key constraint "fk_entitlement_pool" on table "cp_entitlement"
  Detail: Key (id)=(2c90ec8c53c9b0500153cff55b4a0fbc) is still referenced from table "cp_entitlement". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse:2,094
# tail -f /var/log/rhsm/rhsm.log
2016-03-31 23:58:38,781 [DEBUG] subscription-manager:24875 @connection.py:557 - Making request: DELETE /sam/api/consumers/1ee3c47f-2585-4346-a3b6-aea321c9716e
2016-03-31 23:58:46,788 [DEBUG] subscription-manager:24875 @connection.py:589 - Response: status=500
2016-03-31 23:58:46,790 [ERROR] subscription-manager:24875 @managercli.py:174 - Unregister failed
2016-03-31 23:58:46,790 [ERROR] subscription-manager:24875 @managercli.py:175 - Runtime Error ERROR: update or delete on table "cp_pool" violates foreign key constraint "fk_entitlement_pool" on table "cp_entitlement"
  Detail: Key (id)=(2c90ec8c53c9b0500153cff55b4a0fbc) is still referenced from table "cp_entitlement". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse:2,094
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1268, in _do_command
    managerlib.unregister(self.cp, self.identity.uuid)
  File "/usr/share/rhsm/subscription_manager/managerlib.py", line 792, in unregister
    uep.unregisterConsumer(consumer_uuid)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 1127, in unregisterConsumer
    return self.conn.request_delete(method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 693, in request_delete
    return self._request("DELETE", method, params)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 598, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 648, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: Runtime Error ERROR: update or delete on table "cp_pool" violates foreign key constraint "fk_entitlement_pool" on table "cp_entitlement"
  Detail: Key (id)=(2c90ec8c53c9b0500153cff55b4a0fbc) is still referenced from table "cp_entitlement". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse:2,094

Actual results:
Failed to unregister system.

Expected results:
Success to unregister system.

Additional info:

Comment 1 Liushihui 2016-04-01 06:14:22 UTC
Created attachment 1142457 [details]
rhsm.log

Comment 2 Bryan Kearney 2017-06-26 20:33:23 UTC
The release of Satellite 5.8 we are deprecating the support of Subscription Asset Manager. The release notes for 5.8 can be found at https://access.redhat.com/documentation/en-us/red_hat_satellite/5.8/pdf/release_notes/Red_Hat_Satellite-5.8-Release_Notes-en-US.pdf.

I am therefore closing out this bug as WONTFIX. If you believe this to be an error, please feel free tor each out to either Rich Jerrido or Bryan Kearney. Thank you!