Bug 848724 - Dose not check the domain name in the URL via gear REST api
Dose not check the domain name in the URL via gear REST api
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Master (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Ravi Sankar
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-16 05:50 EDT by Wei Sun
Modified: 2015-05-14 20:51 EDT (History)
2 users (show)

See Also:
Fixed In Version: devenv_2051
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-17 17:29:17 EDT
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 Wei Sun 2012-08-16 05:50:23 EDT
Description of problem:
Using gear REST api , whatever the domain name is, it will add the event successfully.

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

How reproducible:
always

Steps to Reproduce:
1.create domain :wsundevman
2.create app:myapp1
3.Get gear usage using REST api with wrong domain
curl -k -X GET -H "Accept: application/xml" --user wsun@redhat.com:redhat https://ec2-174-129-77-200.compute-1.amazonaws.com/broker/rest/domains/a/applications/myapp1/gears

  
Actual results:
[openshift@localhost wsun]$ curl -k -X GET -H "Accept: application/xml" --user wsun@redhat.com:redhat https://ec2-174-129-77-200.compute-1.amazonaws.com/broker/rest/domains/a/applications/myapp1/gears
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
  </supported-api-versions>
  <messages/>
  <version>1.1</version>
  <data>
    <gear>
      <uuid>14700405ed7e4598b94b2a0be5b73232</uuid>
      <components>
        <component>
          <internal-port nil="true"></internal-port>
          <name>php-5.3</name>
          <proxy-host nil="true"></proxy-host>
          <proxy-port nil="true"></proxy-port>
        </component>
        <component>
          <database-name>myapp1</database-name>
          <connection-url>mysql://127.0.250.129:3306/</connection-url>
          <password>7wy8YTMt3lmH</password>
          <username>admin</username>
          <internal-port nil="true"></internal-port>
          <name>mysql-5.1</name>
          <proxy-host nil="true"></proxy-host>
          <proxy-port nil="true"></proxy-port>
        </component>
      </components>
    </gear>
  </data>
  <type>gears</type>
  <status>ok</status>
</response>


Expected results:
it should return error message like, "domain does not exist"

Additional info:
[openshift@localhost wsun]$ curl -k -X GET -H "Accept: application/xml" --user wsun@redhat.com:redhat https://ec2-174-129-77-200.compute-1.amazonaws.com/broker/rest/domains/a/applications/myapp1/
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
  </supported-api-versions>
  <messages>
    <message>
      <exit-code>127</exit-code>
      <field nil="true"></field>
      <severity>error</severity>
      <text>Domain not found.</text>
    </message>
  </messages>
  <version>1.1</version>
  <data>
    <datum nil="true"></datum>
  </data>
  <type nil="true"></type>
  <status>not_found</status>
</response>
Comment 1 Ravi Sankar 2012-08-17 13:27:18 EDT
We have this issue from day 1. This is not specific to gear REST api, any REST api may have this issue. Given valid 'user' and valid user 'application', we are able to retrieve app information and it doesn't care about the domain.

This will be fixed by EOD along with duplicate code cleanup in REST api controllers.
Comment 2 Ravi Sankar 2012-08-20 22:15:04 EDT
https://github.com/openshift/li/pull/280
Comment 3 Ravi Sankar 2012-08-22 04:48:10 EDT
Fixed in git revision bb8b12198.
Comment 4 Wei Sun 2012-08-22 22:44:21 EDT
verified on devenv-stage_233

1.create a domain:wsundev823
2.2.create app:phptest
3.Get gear usage using REST api with wrong domain
[sunwei@dhcp-8-229 dev]$ curl -k -X GET -H "Accept: application/xml" --user wsun@redhat.com:redhat https://ec2-23-22-239-11.compute-1.amazonaws.com/broker/rest/domains/a/applications/phptest/gears
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <type nil="true"></type>
  <version>1.1</version>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
  </supported-api-versions>
  <data>
    <datum nil="true"></datum>
  </data>
  <status>not_found</status>
  <messages>
    <message>
      <field nil="true"></field>
      <exit-code>127</exit-code>
      <text>Domain a not found</text>
      <severity>error</severity>
    </message>
  </messages>
</response>

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