Bug 798884 - [REST API] No exit-code and incorrect application id is shown when calling gear REST API
[REST API] No exit-code and incorrect application id is shown when calling ge...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Kubernetes (Show other bugs)
1.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Ravi Sankar Penta
libra bugs
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-01 02:50 EST by Johnny Liu
Modified: 2014-06-18 02:54 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-03-19 14:23:27 EDT
Type: ---
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 Johnny Liu 2012-03-01 02:50:23 EST
Description of problem:
Give a non-existing app name (phptest1) on purpose upon calling rest api,

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

How reproducible:
Always

Steps to Reproduce:
1. Call gear rest api with a non-existing app name (phptest1) on purpose.
$ curl -k -X GET -H 'Accept: application/xml' --user jialiu@redhat.com:214214 https://ec2-184-73-117-151.compute-1.amazonaws.com/broker/rest/domains/jialiu/applications/phptest1/gears
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <type nil="true"></type>
  <version>1.0</version>
  <messages>
    <message>
      <field nil="true"></field>
      <severity>error</severity>
      <exit-code nil="true"></exit-code>
      <text>Application 70226569206200 not found.</text>
    </message>
  </messages>
  <data nil="true"></data>
  <status>not_found</status>
</response>


  
Actual results:
1. No exit-code, according to Bug 787295, every error message should have exit_code.
2. application id is not correct
<text>Application 70226569206200 not found.</text>
should be
<text>Application phptest1 not found.</text>

Expected results:
exit-code and app id is shown correctly in the output of rest api.

Additional info:
About application id issue:
cloud-sdk/controller/lib/cloud-sdk-controller/app/controllers/gears_controller.rb:
<--snip-->
  def show
    domain_id = params[:domain_id]
    app_id = params[:application_id]

    app = Application.find(@cloud_user,app_id)

    if app.nil?
      @reply = RestReply.new(:not_found)
      message = Message.new(:error, "Application #{id} not found.")
      @reply.messages.push(message)
      respond_with @reply, :status => @reply.status
<--snip-->

app_id should be changed to id
or 
#{id} should be changed to #{app_id}
Comment 1 Ravi Sankar 2012-03-15 15:06:20 EDT
Fixed.
Comment 2 Johnny Liu 2012-03-16 07:25:56 EDT
Verified this bug with devenv_stage_144, and PASS.

$ curl -k -X GET -H "Accept: application/xml" --user jialiu@redhat.com:xx https://ec2-50-17-147-234.compute-1.amazonaws.com/broker/rest/domains/jialiu/applications/phptest1/gears
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <data nil="true"></data>
  <status>not_found</status>
  <version>1.0</version>
  <type nil="true"></type>
  <messages>
    <message>
      <severity>error</severity>
      <text>Application 'phptest1' not found.</text>
      <exit-code>101</exit-code>
      <field nil="true"></field>
    </message>
  </messages>
</response>

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