Bug 749517

Summary: product name uniqueness - org scope *only*
Product: [Retired] Katello Reporter: Garik Khachikyan <gkhachik>
Component: Webservice APIAssignee: Ivan Necas <inecas>
Status: CLOSED DUPLICATE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0CC: dgoodwin, mkoci
Target Milestone: ---Keywords: Triaged
Target Release: 1.x   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-28 08:52:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Garik Khachikyan 2011-10-27 10:26:55 UTC
Description of problem:
Seems that having product name the same in both organizations is not working recently.

Version-Release number of selected component (if applicable):
katello-0.1.96-1.git.15.371d68d.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1.org create --name org1
2.org create --name org2
3. provider create --name provider1_1 --org org1 --type custom
4. provider create --name provider1_2 --org org2 --type custom
5. product create --name pulpF15-x86_64 --org org1 --provider provider1_1 --url http://repos.fedorapeople.org/repos/pulp/pulp/fedora-15/x86_64/ --assumeyes
6. doing the same for org2 & provider1_2 *FAILS*
  
Actual results:
Candlepin JDBC exception:
---
RestClient::InternalServerError: Candlepin::Product: 500 Internal Server Error {"displayMessage":"Runtime Error Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598"} (POST /candlepin/products/)
---

Expected results:
no exception - products are unique in scopes of orgs only.

Additional info:

Comment 1 Garik Khachikyan 2011-10-27 10:29:04 UTC
Oct 27 12:26:03 [http-8443-2] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: duplicate key value violates unique constraint "cp_product_name_key"

Comment 2 Devan Goodwin 2012-01-05 15:05:48 UTC
Products are global in Candlepin, both the product ID and it's name. It may be possible that we could remove the unique constraint on name but it's a little worrisome for us. 

Propose Katello tries to keep the product names unique and handle the situation when they're not.

If this is unacceptable let us know and we can investigate removing that unique product name.

Comment 3 Ivan Necas 2012-02-28 08:52:05 UTC

*** This bug has been marked as a duplicate of bug 784712 ***