Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1065369

Summary: Display error/warning message when tried to set a very long value for the release version in the activation key
Product: [Community] Candlepin (Migrated to Jira) Reporter: Rehana <redakkan>
Component: candlepinAssignee: William Poteat <wpoteat>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.9CC: bkearney, jsefler, wpoteat
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: 2019-09-24 14:16:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rehana 2014-02-14 13:50:52 UTC
Description of problem:


Version-Release number of selected component (if applicable):
subscription-manager version 
server type: Red Hat Subscription Management
subscription management server: 0.9.3-1
subscription-manager: 1.10.13-1.git.7.73e9173.el7
python-rhsm: 1.10.12-1.git.0.9d3a8c6.el7


How reproducible:
3/3

Steps to Reproduce:
1.Set a very long value for release version
ex:curl -H "Content-Type:application/json" -X POST -k -u username:password "https://server:port/candlepin/activation_keys/8ac6a3624430214e0144302164da000d/release" -d '{"releaseVer":"update_releaseversion123456789012345678901234567890123456789012345678901234567890123456789011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"}'


Actual results:
curl -H "Content-Type:application/json" -X POST -k -u username:password "https://server:port/candlepin/activation_keys/8ac6a3624430214e0144302164da000d/release" -d '{"releaseVer":"update_releaseversion123456789012345678901234567890123456789012345678901234567890123456789011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"}'

{"displayMessage":"Runtime Error org.hibernate.exception.DataException: could not execute statement at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse:2,102","requestUuid":"0ab68dde-0993-4cd3-bd44-80ef85d79e88"}

Expected results:
should display appropriate error message, also suggesting to set a max length for the release version as its accepting large data

ex:
[root@hp-ml350egen8-01 ~]# subscription-manager release --show 
Release: update_releaseversion123456789012345678901234567890123456789012345678901234567890123456789011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
[root@hp-ml350egen8-01 ~]# subscription-manager repos --list 
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   awesomeos
Repo Name: awesomeos
Repo URL:  https://cdn.redhat.com/path/to/$basearch/update_releaseversion12345678901234567890123456789012345678901234567890123456789012345678901111111           1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
           111111111/awesomeos
Enabled:   0



Additional info:

Comment 1 William Poteat 2014-05-01 19:38:25 UTC
master commit a0db7c35f8d7ee71daeabaf39788b3f47206e0e0

Comment 2 Bryan Kearney 2014-09-29 17:53:50 UTC
Acking 7.1

Comment 3 Bryan Kearney 2014-09-29 17:55:10 UTC
Acking 7.1

Comment 4 Bryan Kearney 2014-11-07 17:17:52 UTC
This feature was delivered in 0.9.10. It is live in both the portal and satellite 6

Comment 5 Rehana 2014-11-11 08:28:02 UTC
Retested,
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.35-1
subscription management rules: 5.11
subscription-manager: 1.13.8-1.el7
python-rhsm: 1.13.7-1.el7


Observed that now appropriate message "size must be between 0 and 255" is displayed when tried to set very long release version

Creating actvationkey with release version:

curl -H "Content-Type:application/json" -X POST -k -u admin:admin "https://server:8443/candlepin/owners/admin/activation_keys" -d '{"name":"actkey","releaseVer":"update_releaseversion123456789012345678901234567890123456789012345678901234567890123456789011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"}'
{"displayMessage":"releaseVer: size must be between 0 and 255","requestUuid":"54a354ec-d1d1-4fa2-a4bb-a78efc263c0c"}

Modifying  release version:

curl -H "Content-Type:application/json" -X PUT -k -u admin:admin "https://server:8443/candlepin/activation_keys/ff8080814983da4601499ddd22094528" -d '{"releaseVer":"update_releaseversion123456789012345678901234567890123456789012345678901234567890123456789011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"}' | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   400    0   116  100   284     83    204  0:00:01  0:00:01 --:--:--   204
{
    "displayMessage": "releaseVer: size must be between 0 and 255",
    "requestUuid": "78f6feb7-352a-4d74-8e76-d1ef0a3ab74d" }


Marking Verified.