Bug 728636 - duplicate activation key error is hard to decipher
duplicate activation key error is hard to decipher
Status: CLOSED CURRENTRELEASE
Product: Candlepin
Classification: Community
Component: candlepin (Show other bugs)
0.5
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: William Poteat
John Sefler
:
Depends On:
Blocks: rhsm-rhel62
  Show dependency treegraph
 
Reported: 2011-08-05 17:19 EDT by John Sefler
Modified: 2015-05-14 11:22 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-05-30 09:13:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description John Sefler 2011-08-05 17:19:31 EDT
Description of problem:
When attempting to create an activation key using a name that has already been used, we get the following error:

Runtime Error org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598

This seems like a common enough user error to warrant an error message that is easier to understand.


Version-Release number of selected component (if applicable):
[root@jsefler-onprem-62candlepin candlepin]# git show-ref | grep master
895fdff46e33a607d63350df9bdd7bdd275b9e17 refs/heads/master
895fdff46e33a607d63350df9bdd7bdd275b9e17 refs/remotes/origin/master

How reproducible:


Steps to Reproduce:
[jsefler@jseflerT510 ~]$ curl -k --request POST --user testuser1:password --data '{"name":"DUPLICATE-KEY"}' --header 'accept: application/json' --header 'content-type: application/json'  https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/owners/admin/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
108   272  100   272    0    24    586     51 --:--:-- --:--:-- --:--:--   774
{
    "created": "2011-08-05T21:13:32.095+0000", 
    "id": "8a90f8c63196bb2001319bcb38bf3a28", 
    "name": "DUPLICATE-KEY", 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f8c63196bb20013196bb9e210006", 
        "key": "admin"
    }, 
    "pools": [], 
    "updated": "2011-08-05T21:13:32.095+0000"
}
[jsefler@jseflerT510 ~]$ curl -k --request POST --user testuser1:password --data '{"name":"DUPLICATE-KEY"}' --header 'accept: application/json' --header 'content-type: application/json'  https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/owners/admin/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
111   208  100   208    0    24    462     53 --:--:-- --:--:-- --:--:--   611
{
    "displayMessage": "Runtime Error org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598"
}
[jsefler@jseflerT510 ~]$ 



  
Actual results:


Expected results:


Additional info:
Comment 1 J.C. Molet 2011-08-19 10:28:20 EDT
Looks like it works now:

[jmolet@jmolet ~]$ curl -k --request POST --user testuser1:password --data '{"name":"dupkey"}' --header 'accept: application/json' --header 'content-type: application/json' https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/owners/admin/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   282  100   265  100    17    560     35 --:--:-- --:--:-- --:--:--   676
{
    "created": "2011-08-19T14:26:34.182+0000", 
    "id": "8a90f8c631c3a8100131e26faa461187", 
    "name": "dupkey", 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f8c631c3a8100131c3a899e90006", 
        "key": "admin"
    }, 
    "pools": [], 
    "updated": "2011-08-19T14:26:34.182+0000"
}
[jmolet@jmolet ~]$ curl -k --request POST --user testuser1:password --data '{"name":"dupkey"}' --header 'accept: application/json' --header 'content-type: application/json' https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/owners/admin/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   102  100    85  100    17    242     48 --:--:-- --:--:-- --:--:--   302
{
    "displayMessage": "Activation key name [dupkey] is already in use for owner [admin]"
}



[jmolet@jmolet ~]$ curl -k --request GET --user testuser1:password  https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/status | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    48  100    48    0     0    142      0 --:--:-- --:--:-- --:--:--   187
{
    "release": "1", 
    "result": true, 
    "version": "0.4.10"
}


marking VERIFIED

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