Bug 659026

Summary: rhn-manage-channel-internal throws a sensible error when the database hits a unique constraint
Product: [Retired] Red Hat Network Reporter: Stephen Herr <sherr>
Component: RHN/BackendAssignee: rhn-dev-list
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Network Quality Assurance <rhn-qa-list>
Severity: medium Docs Contact:
Priority: low    
Version: RHN StableCC: ggainey, nbronson, vambati
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-23 20:19:56 UTC Type: ---
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: 658545    

Description Stephen Herr 2010-12-01 19:50:45 UTC
Instead of just exploding with an ISE when the database hits a unique constraint we should return an error message that tells the user what field is not unique so they can fix it.

Comment 1 Stephen Herr 2010-12-03 15:52:55 UTC
Updates include:

1) For any of the content-mgmt tools: When the database throws a unique constraint error we either display a plain-English explanation of what is required if the constraint is one that we have a plain-English explanation of, or the name of the constraint otherwise. 

2) For any tools that have updated error handling code (currently just manage-channel): We display the data that the error was caused by.

3) For any of the content-mgmt tools (assuming version 0.8.3 or higher): If using a csv to upload data we display the line that the error occurred on.


Venkat, to test:

0) Install the newest rhn-content-mgmt version: https://brewweb.devel.redhat.com/buildinfo?buildID=150698

1) Get a baseline csv that you will modify: 'rhn-manage-channel-internal
--server dev --username <username> --password <password> --list
rhel-i386-server-5 > test.csv'

2) Change the label, try to create channel with that csv: 'rhn-manage-channel-internal --server dev --username <username> --password <password> --create --csv test.csv'

3) You should receive a unique constraint error about the name with the upgrades listed above.

4) Change the name, try again

5) You should receive a different unique constraint error with the upgrades listed above.

6) Similar things should happen for creating or updating channels, or for different tools altogether. Experiment and have fun.

Comment 2 venkat 2010-12-10 17:06:54 UTC
Verified in dev.

Tested both

rhn-manage-channel-internal
and
rhn-manage-errata-product

both of them are giving 

Error Message:
    Unique Constraint Error:

Error Class Code: 23
Error Class Info: Could not update database entry.