Bug 796421

Summary: Pools with Duplicate ProductPoolAttributes cannot be deleted
Product: [Community] Candlepin Reporter: Andrew Edwards <aedwards>
Component: candlepinAssignee: William Poteat <wpoteat>
Status: CLOSED CURRENTRELEASE QA Contact: Eric Sammons <esammons>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.5CC: tpfromme, wpoteat
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 809078 (view as bug list) Environment:
Last Closed: 2012-07-17 13:04:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 809078    
Attachments:
Description Flags
stack trace of hibernate exception for constraint violation none

Description Andrew Edwards 2012-02-22 20:38:38 UTC
Created attachment 565095 [details]
stack trace of hibernate exception for constraint violation

Description of problem:
If a pool has duplicate ProductPoolAttributes it can not be deleted via the DELETE pool api method or via refresh pools.

Version-Release number of selected component (if applicable):
0.5.5.2

How reproducible:
100%

Steps to Reproduce:
1. Create a new pool
2. Create a ProductPoolAttribute and set pool_id to the previously created pool
3. Duplicate the created ProductPoolAttribute and change the id
4. call DELETE /pools/{pool_id}
  
Actual results:
hibernate raises constraint violation (see attached)

Expected results:
pool is deleted.

Additional info:
if you were to call GET /pools/{pool_id} you will only see one of the attributes created. I think this may be the root of the problem since hibernate may only be trying to delete one of the attributes. When it attempts to save this state back to the database the existing ProductPoolAttribute complains.

Comment 1 Andrew Edwards 2012-02-22 20:43:15 UTC
To be clear, this is a problem we can see in QA,STAGE, PROD environments. We have not determined how the ProductPoolAttributes were duplicated but many of our pools have this issue.

Comment 2 William Poteat 2012-04-02 12:06:52 UTC
commit bbc8359d0d1fb9fba8837f838e8c00eb3c62e152 on master.

This fix will allow the pool to be deleted even if duplicate attributes have been created. 

A separate bug will be set up to cover the problem of the attributes creation.

Comment 3 Bryan Kearney 2012-07-17 13:04:01 UTC
Marking all community bugs modified or beyong as closed.