Bug 980928

Summary: there's no message with field "result" in the messages that I get when creating cartridges/applications
Product: OpenShift Online Reporter: Andre Dietisheim <adietish>
Component: MasterAssignee: Lili Nader <lnader>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 2.xCC: abhgupta, ccoleman, dmcphers, jhou, mfisher, wjiang, xtian, zzhao
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-22 15:20:38 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 Andre Dietisheim 2013-07-03 14:42:01 UTC
Description of problem:
When creating an application or a cartridge (that I embed) I expect the result of this operation in the messages "block". In protocol 1.2 I had so far something like this:

"messages":[
      {
        "exit_code":null,
         "field":null,
         "severity":"info",
         "text":"Application jekyll was created."
      },
      {
         "exit_code":0,
         "field":"current_ip",
         "severity":"info",
         "text":"107.21.169.102"
      },
      {
         "exit_code":0,
         "field":"result",
         "severity":"info",
         "text":"\nJenkins created successfully.  Please make note of these credentials:\n\n   User: admin\n   Password: edWlFXhq-BqY\n\nNote:  You can change your password at: https://jekyll-foobarz.rhcloud.com/me/configure\n\n"
      }
   ],

There's a field "result" that I show to the user in the OpenShift tools for Eclipse. 
In the latest version OpenShift is not giving me a "results" fields any more and thus breaks my existing clients. I get something like this (when embedding mysql):

"messages": [
    {
        "exit_code" => big integer 0,
        "field" => undefined,
        "severity" => "info",
        "text" => "Added mysql-5.1 to application as71"
    },
    {
        "exit_code" => big integer 0,
        "field" => undefined,
        "severity" => "debug",
        "text" => "

mysql-5.1: Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT
"
    },
    {
        "exit_code" => big integer 0,
        "field" => undefined,
        "severity" => "result",
        "text" => "MySQL 5.1 database added.  Please make note of these credentials:
       Root User: adminv15iriK
   Root Password: nyZ77qp5-h61
   Database Name: as71
Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
You can manage your new MySQL database by also embedding phpmyadmin-3.4.
The phpmyadmin username and password will be the same as the MySQL credentials above.
"
    }
]

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

How reproducible:
always

Steps to Reproduce:
1. embed mysql to an existing application
2. check the response for "messages": and see if there's a field "result"
3.

Actual results:
No "result" field is present and thus existing clients for the EClipse tooling dont get the required informations (like url, credentials)

Expected results:
I should get a "result" field that I can show to the user as we could with the prior implementations

Additional info:

Comment 1 Clayton Coleman 2013-07-03 14:46:34 UTC
This is a regression in behavior for old API clients which breaks processing of cartridge response data (which contains critical information).

Older API versions should continue to have their correct behavior.  This blocks the release of the Eclipse client tools, and in all likelihood needs to be hotfixed to production.

Comment 2 weiwei jiang 2013-07-04 03:01:06 UTC
tested on jboss tool 4.1.0 cr1 and found that return no messages after add cartridge to app now

Comment 3 Andre Dietisheim 2013-07-06 09:29:37 UTC
We had to freeze CR1 yesterday which should become GA without any changes in the ideal case. We could therefore not wait for a hotfix and worked around it by looking either for a "result" field or a "result" severity in the "default" fields. 

https://github.com/jbosstools/jbosstools-openshift/pull/188/files#L5R79

This allows us that our tooling works with current Online and existing OSE instances.

Comment 4 weiwei jiang 2013-07-08 10:12:48 UTC
test on jbosstool 4.1.0 CR1a and it works, thx
And when add some non-supported cartridges for scalable app, the result of supported cartridge will not display.

Comment 5 Andre Dietisheim 2013-07-08 18:42:06 UTC
(In reply to weiwei jiang from comment #4)
> test on jbosstool 4.1.0 CR1a and it works, thx

thanks for confirming weiwei

> And when add some non-supported cartridges for scalable app, the result of
> supported cartridge will not display.

did I read you right, if you try to embed/create unsupported cartridges you wont get any report about it?
Is this expected or should a dialog pop up?

Comment 6 weiwei jiang 2013-07-09 02:00:12 UTC
(In reply to Andre Dietisheim from comment #5)
> (In reply to weiwei jiang from comment #4)
> > test on jbosstool 4.1.0 CR1a and it works, thx
> 
> thanks for confirming weiwei
> 
> > And when add some non-supported cartridges for scalable app, the result of
> > supported cartridge will not display.
> 
> did I read you right, if you try to embed/create unsupported cartridges you
> wont get any report about it?
> Is this expected or should a dialog pop up?

For example, I embed mysql(supported) & phpmyadmin(unsupported) cartridge to a scalable php application, so it will pop up a dialog and display "phpmyadmin unsupported for scalable application", but it wont display the username&password of mysql, so is it expected?

Comment 7 Andre Dietisheim 2013-07-09 12:04:39 UTC
@weiwei: thanks for finding this, I filed it into our jira (I wont attach it to this issue here since this here is not related):

https://issues.jboss.org/browse/JBIDE-15157

Comment 8 Lili Nader 2013-07-09 19:14:31 UTC
The fix for this bug is in pull request


https://github.com/openshift/origin-server/pull/3014

For API versions 1.5 or earlier any messages with severity=result will also have the field set to result.

Note:This is a fix for backward compatibility.  As of version 1.6 (not released yet) the clients should check severity instead of the field attribute.  The field attribute indicates the message is related to a particular attribute of the resource and is used for validation errors.

Comment 9 Andre Dietisheim 2013-07-09 21:04:11 UTC
(In reply to Lili Nader from comment #8)
> The field attribute indicates the message is related to a
> particular attribute of the resource and is used for validation errors.

So for protocol <1.6 in case of success, the property "field" is always undefined?

Comment 10 Andre Dietisheim 2013-07-09 21:05:21 UTC
> So for protocol <1.6 in case of success, the property "field" is always
> undefined?

sorry, mistyped, should say "So for protocol >=1.6 in case of success, the property "field" is always undefined?

Comment 11 Lili Nader 2013-07-10 09:02:17 UTC
Yes

Comment 12 Lili Nader 2013-07-10 09:04:11 UTC
*** Bug 982615 has been marked as a duplicate of this bug. ***

Comment 13 Xiaoli Tian 2013-07-10 10:26:22 UTC
Hi, Lili

Even if the stage pull request is merged, but the master pull request is still not merged and not have [merge] tag yet:

https://github.com/openshift/origin-server/pull/3017

And there's no devenv-stage_399 ready, so it's not ready for testing now.

Thanks

Comment 14 zhaozhanqi 2013-07-11 08:32:40 UTC
check this issue on devenv-stage_399, it has not been fixed  and check the code /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.10.7/lib/openshift/controller/api_responses.rb
did not find the new added code. please confirm. thanks

Comment 17 Jianwei Hou 2013-07-12 11:33:44 UTC
Verified on devenv_3491
the value of 'field' is corrected.

 "messages": [
    {
      "exit_code": 0,
      "field": null,
      "severity": "info",
      "text": "Added mysql to application php1"
    },
    {
      "exit_code": 0,
      "field": null,
      "severity": "debug",
      "text": "\n\nmysql-5.1: Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT\n"
    },
    {
      "exit_code": 0,
      "field": "result",
      "severity": "result",
      "text": "MySQL 5.1 database added.  Please make note of these credentials:\n       Root User: adminbR8iT1a\n   Root Password: 2ZUQKAwW4mln\n   Database Name: php1\nConnection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/\nYou can manage your new MySQL database by also embedding phpmyadmin-3.4.\nThe phpmyadmin username and password will be the same as the MySQL credentials above.\n"
    }
  ],
  "status": "created",
  "supported_api_versions": [
    1.0,
    1.1,
    1.2,
    1.3,
    1.4,
    1.5
  ],
  "type": "cartridge",
  "version": "1.5"