Bug 869196 - Doesn't show response message when set additional_storage by wrong REST_API info
Summary: Doesn't show response message when set additional_storage by wrong REST_API info
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Master
Version: 2.x
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: ---
Assignee: Rajat Chopra
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-23 09:01 UTC by Rony Gong 🔥
Modified: 2015-05-15 00:52 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-14 00:55:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Rony Gong 🔥 2012-10-23 09:01:08 UTC
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: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: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: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: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 09:47:33 UTC
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: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: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:123123 https://localhost/broker/rest/domains/bmengdev/applications/sappwwwwwwww/cartridges/jbossas-7 -XPUT -d additional_storage=3

Comment 3 Wei Sun 2012-12-12 10:33:55 UTC
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 -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 23:22:11 UTC
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-29 02:52:55 UTC
Verified on devenv_2737
1. set un-exist user
[root@F17x64-openshift openshift]# curl -k -X PUT -H 'Accept: application/xml' --user qgong+11: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: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: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: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.