Bug 801705

Summary: Call REST API can't create an application successfully by specified template name
Product: OKD Reporter: bzhao
Component: PodAssignee: Krishna Raman <kraman>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: mfisher
Target Milestone: ---   
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-19 18:23:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description bzhao 2012-03-09 08:33:51 UTC
Description of problem:
Can't create an app and add the template to the app successfully after creating a template by REST API

Version-Release number of selected component (if applicable):
rhc-0.88.2-1.git.0.e1a8823.el6.noarch
rhc-broker-0.88.1-1.git.188.452fd82.el6.noarch

rubygem-cloud-sdk-controller-0.6.1-1.git.198.c411b64.el6.noarch
ruby-cloud-sdk-common-0.6.1-1.git.0.9e4dcac.el6.noarch
rubygem-cloud-sdk-node-0.6.1-1.git.20.a7ae185.el6.noarch
ruby-cloud-sdk-controller-0.6.1-1.git.198.c411b64.el6.noarch
ruby-cloud-sdk-node-0.6.1-1.git.20.a7ae185.el6.noarch
rubygem-cloud-sdk-common-0.6.1-1.git.0.9e4dcac.el6.noarch

How reproducible:
Always

Steps to Reproduce:
Precondition:
Create a quickstart template  - /tmp/foo.yaml

---
Vendor: unknown
Requires:
- php-5.3

- mysql-5.1
Architecture: noarch
Description:
License: unknown
Subscribes:
  doc-root:
    Required: false
    Type: FILESYSTEM:doc-root
Version: 0.0

1.Add a template
# rhc-admin-add-template -n wordpress -d /tmp/foo.yaml -g git://github.com/openshift/wordpress-example.git -t wordpress  -c 1  -m '{"a":"b"}'

2.Create an application and add the template to the application
# curl -k -X POST -H "Accept: application/xml" -H "Content-type: application/json" -d '{name:"<application name>", template:<your template name>}' --user <userName>:<passWD> https://<your instance>/broker/rest/domains/<domain Name>/applications

  
Actual results:
Can't create the application with php type by specified template

Expected results:
The application with php type could be created successfully

Additional info:
# cat /var/www/libra/broker/log/development.log

Log content as follows:

Started POST "/broker/rest/domains/bzhao105/applications" for 203.114.244.88 at Fri Mar 09 03:10:58 -0500 2012
  Processing by ApplicationsController#create as XML
  Parameters: {"name"=>"test", "domain_id"=>"bzhao105", "template"=>"3806ff37b600428699c0a4104b16cbc6"}
MongoDataStore.find(CloudUser, bzhao105, bzhao105)

Checking to see if user limit for number of apps has been reached
MongoDataStore.find(ApplicationTemplate, , 3806ff37b600428699c0a4104b16cbc6)

Completed 500 Internal Server Error in 199ms

TypeError (instance of IO needed):
  

Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.8ms)
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (174.2ms)
Rendered /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (181.1ms)


Started GET "/broker/rest/domains.json" for 127.0.0.1 at Fri Mar 09 03:13:35 -0500 2012
  Processing by DomainsController#index as JSON
MongoDataStore.find(CloudUser, xtian+t19, xtian+t19)

Completed 200 OK in 239ms (Views: 18.5ms)


Started GET "/broker/rest//domains/domx13/applications.json" for 127.0.0.1 at Fri Mar 09 03:13:35 -0500 2012
  Processing by ApplicationsController#index as JSON
  Parameters: {"domain_id"=>"domx13"}
MongoDataStore.find(CloudUser, xtian+t19, xtian+t19)

Completed 200 OK in 289ms (Views: 50.8ms)


Started POST "/broker/cartlist" for 66.187.233.202 at Fri Mar 09 03:17:03 -0500 2012
  Processing by LegacyBrokerController#cart_list_post as 
  Parameters: {"password"=>"[FILTERED]", "json_data"=>"{\"api\":\"1.1.2\",\"cart_type\":\"standalone\"}"}
User-Agent = ''
Completed 200 OK in 5ms (Views: 2.6ms)

Comment 1 Krishna Raman 2012-03-09 20:46:05 UTC
Fixed on branch dev/kraman/US1972. Will be merged into master soon.

Comment 2 bzhao 2012-03-12 09:40:47 UTC
Passed verified on devenv 1658