Bug 1207822 - Duplicate content ids not raising the correct message
Summary: Duplicate content ids not raising the correct message
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Chris "Ceiu" Rog
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks: 1227930
TreeView+ depends on / blocked
 
Reported: 2015-03-31 19:08 UTC by Partha Aji
Modified: 2016-07-22 14:38 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1227930 (view as bug list)
Environment:
Last Closed: 2016-07-22 14:38:50 UTC
Embargoed:


Attachments (Terms of Use)

Description Partha Aji 2015-03-31 19:08:06 UTC
Description of problem:
1) Create an environment
2) Try adding the same content id to environment twice 

Something like this
POST /candlepin/environments/100/content?contentId=1
POST /candlepin/environments/100/content?contentId=1

This raises an error which makes sense. But the error message itself does not complain that its a duplicate content id. We instead get an error like this

RestClient::InternalServerError: Katello::Resources::Candlepin::Environment: 500 Internal Server Error {"displayMessage":"Runtime Error could not execute statement at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse:2,102","requestUuid":"13c15fcd-0bc2-4686-a988-e0ba70377b86"} (POST /candlepin/environments/1/content)

Preferable would be an error that says "Duplicate Resource" with the appropriate status code.

Comment 1 Chris "Ceiu" Rog 2015-04-06 17:01:06 UTC
commit 2b1cf427caf59708f75d5facd237de1a0c0e761c
Author: Chris Rog <crog>
Date:   Tue Mar 31 15:52:04 2015 -0400

    1207822: EnvironmentResource fix for duplicate content IDs
    
    - EnvironmentResource will now throw a ConflictException if an API
      user attempts to promote content that has already been promoted.
    - Added spec tests to verify the above behavior

Comment 2 Barnaby Court 2016-07-22 14:38:50 UTC
Moving to closed per the updated candlepin process for bugs that have been merged or have been taken care of.


Note You need to log in before you can comment on or make changes to this bug.