Bug 963828 - Error message with a Hash as the "field" attribute
Summary: Error message with a Hash as the "field" attribute
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Master
Version: 2.x
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Lili Nader
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-16 15:56 UTC by Fabiano Franz
Modified: 2015-05-15 00:54 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-06-11 03:59:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Fabiano Franz 2013-05-16 15:56:43 UTC
Description of problem: 

When trying to create an app based on an invalid initial Git url the REST API will return a Hash where the field name attribute is expected. This is likely to happen in other REST API calls too. Example response body:

{
    "data": null, 
    "errors": {}, 
    "messages": [
        {
            "exit_code": 130, 
            "field": {
                "appInfoIO": [], 
                "cart_commands": [], 
                "data": "", 
                "debugIO": [], 
                "errorIO": [], 
                "exitcode": 130, 
                "hasUserActionableError": true, 
                "messageIO": [], 
                "properties": {}, 
                "resultIO": []
            }, 
            "severity": "error", 
            "text": "Source Code repository URL type must be one of: git:// http:// https:// file:// ftp:// ftps:// rsync://\n"
        }
    ], 
    "status": "unprocessable_entity", 
    "supported_api_versions": [
        1.0, 
        1.1, 
        1.2, 
        1.3, 
        1.4
    ], 
    "type": null, 
    "version": "1.4"
}

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

How reproducible: always

Steps to Reproduce:
1. curl -X POST -k --user "user:pass" https://openshift.redhat.com/broker/rest/domains/mydomain/applications -d "name=foo&cartridge=php-5.3&initial_git_url=bar" | python -mjson.tool
  
Actual results: message body with invalid "field" attribute in the JSON.

Expected results: the "field" attribute must return the field name involved in the error (in this case specifically 'git_initial_url').

Additional info:

Comment 2 Xiaoli Tian 2013-05-17 12:48:16 UTC
(In reply to comment #1)
> https://github.com/openshift/origin-server/pull/2519


Seems above pull request is for stage only, but seems no pull request for master, and related code is not merged in devenv_3238.

Comment 3 Rony Gong 🔥 2013-05-20 08:26:38 UTC
As comment2, I still can't find the code merged into the latest build devenv_3247

Comment 6 Rony Gong 🔥 2013-05-21 02:42:46 UTC
Verified on 3251 --PASS
[qgong@dhcp-8-154 dev]$ curl -X POST -k --user "qgong:pass" https://ec2-54-224-81-227.compute-1.amazonaws.com/broker/rest/domains/qgong4/applications -d "name=foo&cartridge=php-5.3&initial_git_url=bar" | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
143   241  120   241    0    46    174     33  0:00:01  0:00:01 --:--:--   596
{
    "data": null, 
    "errors": {}, 
    "messages": [
        {
            "exit_code": 216, 
            "field": "initial_git_url", 
            "severity": "error", 
            "text": "Invalid initial git URL"
        }
    ], 
    "status": "unprocessable_entity", 
    "supported_api_versions": [
        1.0, 
        1.1, 
        1.2, 
        1.3, 
        1.4
    ], 
    "type": null, 
    "version": "1.4"


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