Bug 796287

Summary: [REST API] POST app with empty name returns 500 error, stack trace
Product: OKD Reporter: Clayton Coleman <ccoleman>
Component: PodAssignee: Lili Nader <lnader>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 2.xCC: bmeng, mfisher, rmillner
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-02 21:56:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Clayton Coleman 2012-02-22 15:59:24 UTC
Looks like there is a missing validation check on empty application names - server returns a 500 instead of 422 with error.

Started POST "/broker/rest/domains/domain23/applications.json" for 127.0.0.
1 at Wed Feb 22 10:54:28 -0500 2012
  Processing by ExtendedApplicationsController#create as JSON
  Parameters: {"name"=>"", "cartridge"=>"raw-0.1", "domain_id"=>"domain23",
 "application_type"=>"raw-0.1"}
MongoDataStore.find(CloudUser, test4, test4)

DEBUG: [#<MCollective::RPC::Result:0x7fed29ea2478 @results={:data=>{:output
=>".  Please destroy then recreate, or pick a new name: /var/lib/libra/e21b
c598280a4c9680e182adfff04624/\n", :exitcode=>132}, :statusmsg=>"cartridge_d
o_action failed 132.  Output .  Please destroy then recreate, or pick a new
 name: /var/lib/libra/e21bc598280a4c9680e182adfff04624/\n", :statuscode=>1,
 :sender=>"ip-10-224-27-88"}, @action="cartridge_do", @agent="libra">]
DEBUG: server results: .  Please destroy then recreate, or pick a new name:
 /var/lib/libra/e21bc598280a4c9680e182adfff04624/
Node execution failure (invalid exit code from node).  If the problem persi
sts please contact Red Hat support.
#<Cloud::Sdk::NodeException: Node execution failure (invalid exit code from
 node).  If the problem persists please contact Red Hat support.>
["/var/www/libra/broker/lib/express/broker/application_container_proxy.rb:858:in `run_cartridge_command'", "/var/www/libra/broker/lib/express/broker/application_container_proxy.rb:184:in

Comment 1 Meng Bo 2012-02-27 06:26:37 UTC
verified on devenv_1642,
the return is as following:
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>unprocessable_entity</status>
  <data nil="true"></data>
  <messages>
    <message>
      <field>name</field>
      <exit-code>105</exit-code>
      <severity>error</severity>
      <text>Application name is required and cannot be blank</text>
    </message>
  </messages>
  <version>1.0</version>
  <type nil="true"></type>
</response>

Mark bug as VERIFIED.