Bug 798884 - [REST API] No exit-code and incorrect application id is shown when calling gear REST API
Summary: [REST API] No exit-code and incorrect application id is shown when calling ge...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Pod
Version: 1.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Ravi Sankar Penta
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-03-01 07:50 UTC by Johnny Liu
Modified: 2014-06-18 06:54 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-03-19 18:23:27 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Johnny Liu 2012-03-01 07:50:23 UTC
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: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 19:06:20 UTC
Fixed.

Comment 2 Johnny Liu 2012-03-16 11:25:56 UTC
Verified this bug with devenv_stage_144, and PASS.

$ curl -k -X GET -H "Accept: application/xml" --user jialiu: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.