Bug 1061098

Summary: Friendly message in REST request for too long env variable
Product: OpenShift Online Reporter: Oleg Fayans <ofayans>
Component: MasterAssignee: Dan McPherson <dmcphers>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.xCC: amarecek, dmcphers, jhou
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: 2014-02-26 19:11:03 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 Oleg Fayans 2014-02-04 11:40:14 UTC
Description of problem:
When I try to set up an environmental variable that is too long (>128 characters) via rest, I get Internal server error. We need to rescue errors like that and provide users with a message like "env var is too long"

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
$ curl -k -X POST https://ec2-54-226-173-25.compute-1.amazonaws.com/broker/rest/application/52f0cf7d509e425dbf00016c/environment-variables --data-urlencode name=BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB --data-urlencode value=batr -u ofayans:redhat

{"api_version":1.6,"data":null,"messages":[{"exit_code":0,"field":null,"index":null,"severity":"error","text":"Failed to update environment variable(s) on your application's gear(s).  Please try again and contact support if the issue persists."}],"status":"internal_server_error","supported_api_versions":[1.0,1.1,1.2,1.3,1.4,1.5,1.6],"type":null,"version":"1.6"}

Expected results:


Additional info:

Comment 1 Dan McPherson 2014-02-06 21:43:05 UTC
https://github.com/openshift/li/pull/2344

Comment 4 Jianwei Hou 2014-02-07 05:29:46 UTC
Verified on devenv_4341, the response from restapi is friendly and meaningful.

curl -s -k -H 'Content-Type: Application/json' -u jhou:redhat https://ec2-184-73-129-69.compute-1.amazonaws.com/broker/rest/application/52f45084bf14a34c63000001/environment-variables -X POST -d '{"name":"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "value":"batr"}'


{"api_version":1.6,"data":null,"messages":[{"exit_code":188,"field":"name","index":null,"severity":"error","text":"Name must be 128 characters or less."}],"status":"unprocessable_entity","supported_api_versions":[1.0,1.1,1.2,1.3,1.4,1.5,1.6],"type":null,"version":"1.6"}