Bug 797764

Summary: When fail to create an application using the quickstart template via REST API server side does not roll back.
Product: OKD Reporter: Johnny Liu <jialiu>
Component: PodAssignee: Krishna Raman <kraman>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.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:19 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 Johnny Liu 2012-02-27 09:24:13 UTC
Description of problem:


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

How reproducible:
Always

Steps to Reproduce:
1. Create a yaml file requiring some no-existing package:
e.g:
# cat badfoo.yaml 
Vendor: unknown
Requires:
- php-5.3
- mysql-5.1
- rhc-aa
Architecture: noarch
Description:
License: unknown
Subscribes:
  doc-root:
    Required: false
    Type: FILESYSTEM:doc-root
Version: 0.0

2. Add a template
# rhc-admin-add-template -n badfoo -d ~/badfoo.yaml -g git://github.com/openshift/wordpress-example1.git -t mytag  -c 1  -m '{"a":"b"}'

3. Call REST API to try to create app from quickstart template

Actual results:
Fail to create app, but the app info is shown in the rhc-domain-info's output, user even can not destroy this app.

# curl -k -X POST -H "Accept: application/xml" -H "Content-type: application/json" -d '{name:"myapp1", template: 1cec7d8d758b491c927a78b4efb9eecb}' --user jialiu:xx https://ec2-184-73-110-196.compute-1.amazonaws.com/broker/rest/domains/jialiu/applications
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Action Controller: Exception caught</title>
<--snip-->
</head>
<body>

<h1>
  NoMethodError
    in ApplicationsController#create
</h1>
<pre>You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each</pre>


<p><code>Rails.root: /var/www/libra/broker</code></p>

<--snip-->

$ rhc-ctl-app -a myapp1 -c destroy -p xx -b
Problem reported from server. Response code was 500.
Re-run with -d for more information.

RESULT:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each


Expected results:
When app failed to configure, server side should roll back to keep a clean user info.

Additional info:

Comment 1 Krishna Raman 2012-02-27 19:46:41 UTC
Fixed in 2af7b9d6fcdff0e55deb93dc0d5f40864a2aca71

Comment 2 Meng Bo 2012-02-28 07:25:19 UTC
proper error message shows on devenv_1648, and no application created.

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <version>1.0</version>
  <type nil="true"></type>
  <messages>
    <message>
      <field nil="true"></field>
      <exit-code nil="true"></exit-code>
      <severity>error</severity>
      <text>Failed to create application wordpress1 due to:Invalid cartridge specified: rhc-xx</text>
    </message>
  </messages>
  <status>internal_server_error</status>
  <data nil="true"></data>
</response>