Bug 869196 - Doesn't show response message when set additional_storage by wrong REST_API info
Doesn't show response message when set additional_storage by wrong REST_API info
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Master (Show other bugs)
2.x
Unspecified Unspecified
low Severity low
: ---
: ---
Assigned To: Rajat Chopra
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-23 05:01 EDT by Rony Gong
Modified: 2015-05-14 20:52 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-13 19:55:05 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Rony Gong 2012-10-23 05:01:08 EDT
Description of problem:
Use Rest API to set additional_storage, but when use non_existing user, non_existing domain_name, application_name, cartridge_name, it won't return any error prompt message.

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

How reproducible:
always

Steps to Reproduce:
1.Create app then set additional_storage for the cartridge with  non_existing user
2.set additional_storage for the cartridge with  non_existing domain_name
3..set additional_storage for the cartridge with  non_existing application_name
4. .set additional_storage for the cartridge with  non_existing cartridge_name
  
Actual results:
[qgong@localhost non_scalable]$ curl -k -X PUT -H 'Accept: application/xml' --user qgong_unexist@redhat.com:111111 -d additional_storage=3 https://ec2-23-23-31-67.compute-1.amazonaws.com/broker/rest/domains/qgong7/applications/qsjbossas/cartridges/jbosseap-6.0

[qgong@localhost non_scalable]$ curl -k -X PUT -H 'Accept: application/xml' --user qgong@redhat.com:111111 -d additional_storage=3 https://ec2-23-23-31-67.compute-1.amazonaws.com/broker/rest/domains/qgong7/applications/qsjbossas/cartridges/jbosseap-6.0

[qgong@localhost non_scalable]$ curl -k -X PUT -H 'Accept: application/xml' --user qgong@redhat.com:111111 -d additional_storage=3 https://ec2-23-23-31-67.compute-1.amazonaws.com/broker/rest/domains/not_exist_domain/applications/qsjbossas/cartridges/jbossas-7

[qgong@localhost non_scalable]$ curl -k -X PUT -H 'Accept: application/xml' --user qgong@redhat.com:111111 -d additional_storage=3 https://ec2-23-23-31-67.compute-1.amazonaws.com/broker/rest/domains/qgong6/applications/not_exist_app/cartridges/jbossas-7
[qgong@localhost non_scalable]$

Expected results:
Show correspond error message for user. 


Additional info:
Comment 2 Meng Bo 2012-11-30 04:47:33 EST
Checked on fork_ami_US3025_301,

Only the condition which is using the non-existing cartridge will return error message like:
    <message>
      <severity>error</severity>
      <text>Cartridge jbosseap-6.0 for application sapp not found</text>
      <exit-code>129</exit-code>
      <field nil="true"></field>
    </message>


For the non-exist user name, non-exist domain name, and non-exist app name, they are still did not throw out any words. Will these be fixed?

[root@ip-10-62-98-50 ~]# curl -k -H 'Accept: application/xml' --user wwwwwwwwbmeng@redhat.com:123123 https://localhost/broker/rest/domains/bmengdev/applications/sapp/cartridges/jbossas-7 -XPUT -d additional_storage=3

[root@ip-10-62-98-50 ~]# curl -k -H 'Accept: application/xml' --user bmeng@redhat.com:123123 https://localhost/broker/rest/domains/bmengdevwwwwwwww/applications/sapp/cartridges/jbossas-7 -XPUT -d additional_storage=3

[root@ip-10-62-98-50 ~]# curl -k -H 'Accept: application/xml' --user bmeng@redhat.com:123123 https://localhost/broker/rest/domains/bmengdev/applications/sappwwwwwwww/cartridges/jbossas-7 -XPUT -d additional_storage=3
Comment 3 Wei Sun 2012-12-12 05:33:55 EST
Test on devenv_2590

Set quota using invalid cartridge ,can not set successfully,but will show message like "Routing Error". Should give a friendly prompt.

[sunwei@dhcp-8-229 dev]$ curl -k -X PUT -H 'Accept: application/xml' --user wsun@redhat.com:redhat -d additional_gear_storage=3 https://ec2-23-22-99-233.compute-1.amazonaws.com/broker/rest/domains/wsunsun/applications/phptest/cartridges/php
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>Action Controller: Exception caught</title>
  <style>
    body { background-color: #fff; color: #333; }
    body, p, ol, ul, td {
      font-family: helvetica, verdana, arial, sans-serif;
      font-size:   13px;
      line-height: 18px;
    }
    pre {
      background-color: #eee;
      padding: 10px;
      font-size: 11px;
      white-space: pre-wrap;
    }
    a { color: #000; }
    a:visited { color: #666; }
    a:hover { color: #fff; background-color:#000; }
  </style>
</head>
<body>
<h1>Routing Error</h1>
<p><pre>No route matches [PUT] &quot;/rest/domains/wsunsun/applications/phptest/cartridges/php&quot;</pre></p>
<p>
  Try running <code>rake routes</code> for more information on available routes.
</p>
</body>
</html>
Comment 4 Rajat Chopra 2013-01-28 18:22:11 EST
Not sure if we should fix this problem entirely. There is a url validator that runs for the cartridge, which should map the regex - /([\w\-]+(-)([\d]+(\.[\d]+)*)+)/

The messaging about cartridge missing will be given if the basic validation passes through. So, try with /applications/phptest/cartridges/php-5 and you will see an appropriate error. 

rev#baf9a96dfc43d4b4263cc7e0c10d81b84eac6f40 origin.repo
Comment 5 Rony Gong 2013-01-28 21:52:55 EST
Verified on devenv_2737
1. set un-exist user
[root@F17x64-openshift openshift]# curl -k -X PUT -H 'Accept: application/xml' --user qgong+11@redhat.com:111111 https://ec2-204-236-200-211.compute-1.amazonaws.com/broker/rest/domains/qgong5/applications/qsphp/cartridges/php-5.3 -d additional_gear_storage=3
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>not_found</status>
  <type nil="true"></type>
  <data>
    <datum nil="true"></datum>
  </data>
  <messages>
    <message>
      <severity>error</severity>
      <text>Domain qgong5 not found</text>
      <exit-code>127</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
  <version>1.3</version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
    <supported-api-version>1.3</supported-api-version>
  </supported-api-versions>
</response>
2. set wrong domain
[root@F17x64-openshift openshift]# curl -k -X PUT -H 'Accept: application/xml' --user qgong+1@redhat.com:111111 https://ec2-204-236-200-211.compute-1.amazonaws.com/broker/rest/domains/qgong56/applications/qsphp/cartridges/php-5.3 -d additional_gear_storage=3
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>not_found</status>
  <type nil="true"></type>
  <data>
    <datum nil="true"></datum>
  </data>
  <messages>
    <message>
      <severity>error</severity>
      <text>Domain qgong56 not found</text>
      <exit-code>127</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
  <version>1.3</version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
    <supported-api-version>1.3</supported-api-version>
  </supported-api-versions>
</response>
3. set wrong application
[root@F17x64-openshift openshift]# curl -k -X PUT -H 'Accept: application/xml' --user qgong+1@redhat.com:111111 https://ec2-204-236-200-211.compute-1.amazonaws.com/broker/rest/domains/qgong5/applications/qsphp1/cartridges/php-5.3 -d additional_gear_storage=3
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>not_found</status>
  <type nil="true"></type>
  <data>
    <datum nil="true"></datum>
  </data>
  <messages>
    <message>
      <severity>error</severity>
      <text>Application 'qsphp1' not found for domain 'qgong5'</text>
      <exit-code>101</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
  <version>1.3</version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
    <supported-api-version>1.3</supported-api-version>
  </supported-api-versions>
</response>
4. set wrong cartridge
[root@F17x64-openshift openshift]# curl -k -X PUT -H 'Accept: application/xml' --user qgong+1@redhat.com:111111 https://ec2-204-236-200-211.compute-1.amazonaws.com/broker/rest/domains/qgong5/applications/qsphp/cartridges/php-5.3.4 -d additional_gear_storage=3
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>not_found</status>
  <type nil="true"></type>
  <data>
    <datum nil="true"></datum>
  </data>
  <messages>
    <message>
      <severity>error</severity>
      <text>Cartridge php-5.3.4 not embedded within application qsphp</text>
      <exit-code>129</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
  <version>1.3</version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
    <supported-api-version>1.3</supported-api-version>
  </supported-api-versions>
</response>

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