Created attachment 644750 [details] development log Description of problem: The error "MultiJson::DecodeError in ApplicationTypesController#index" is shown after creating a quickstart with JSON array format in community. Version-Release number of selected component (if applicable): fork_ami_us3046_quickstarts_and_app_types_293 rhc-1.1.5.gem How reproducible: always Steps to Reproduce: 1.Enable quickstarts on instance. 2.Log into community with admin/admin 3.Go to http://<server>/community/node/add/quickstart to create a quickstart 4.Input title, tag and cartridges with JSON array as displayed in the UI as below: [{"name": "php-5.3", "name": "mysql-5.1"}] 5.Save the quickstart and hit http://<server>/community/cron.php 6.Go to console to create an app with the created quickstart above. Actual results: Error is shown at attached. Expected results: App can be created with this quickstart. Additional info: It works well with this way :A comma delimited list of cartridge names: php-5.3, mysql-5.1
Created attachment 644752 [details] Error from web console
The story is merged to master now, fix is in pull-request https://github.com/openshift/origin-server/pull/898 to master
This bug has not been fixed completely, Please refer to the details as below: Build verion: rhc.1.1.7.gem devenv_2474 Verified steps: 1.Enable quickstarts on instance. 2.Log into community with admin/admin 3.Go to http://<server>/community/node/add/quickstart to create a quickstart 4.Input title, tag and cartridges with JSON array as displayed in the UI as below: [{"name": "php-5.3", "name": "mysql-5.1"}] 5.Save the quickstart and hit http://<server>/community/cron.php 6.Go to console to create an app with the created quickstart above. Actual results: 1. The created quickstarts are not listed when accessing the create application page in console. 2. Try to search the created quickstarts by tags, the same error is occurred. Expected results: The created quickstarts should be listed in the console for application creation page, and it should be work well for app creation. Please refer to the full trace of site as attached. Thanks.
Created attachment 645305 [details] full trace from site
Created attachment 645335 [details] error.log Test on devenv_2474. I create a quickstart template and add a template on instance. Template 3e39113a4e8342098392f27f7fa17fb6 created.Then,I create an app and add the template to the app,but will display the error as attachment.
The info above is from submittiting to the broker - however you're sending invalid input so it's no surprise you get that error. Possibly we should be more gracefully handling it
(In reply to comment #6) > The info above is from submittiting to the broker - however you're sending > invalid input so it's no surprise you get that error. Possibly we should be > more gracefully handling it Yes, I tried Restapi as below, it can work well on devenv_2485. #curl -k -X POST -H "Accept: application/xml" -d name=myapp1 -d template=b682148cad584771a7fa6dff7fb3c4ad --user test:test https://ec2-50-16-140-44.compute-1.amazonaws.com/broker/rest/domains/testdm11/applications However, for the quickstart created in community with JSON format, the actual results are different as before. Please refer to the details as below: Steps: 1.Enable quickstarts on instance. 2.Log into community with admin/admin 3.Go to http://<server>/community/node/add/quickstart to create a quickstart 4.Input title, tag and cartridges with JSON array as displayed in the UI as below: [{"name": "php-5.3", "name": "mysql-5.1"}] 5.Save the quickstart and hit http://<server>/community/cron.php 6.Go to console to create an app with the created quickstart above. Actual results: The quickstart is listed in create application page, but the cartridges (php-5.3, mysql-5.1) are missing when creating app with this quickstart. What's more, the Create application button is invalid. It can not create app with this quickstart. Please refer to the screenshot for the quickstart and create application page.
Created attachment 646246 [details] CreatedQuickstart1116
Created attachment 646247 [details] Cartridges of the quickstart are missing 1116
Changed summary as actual results are different as before.
The error is coming from rails before even it gets to applications_controller. It is failing to parse JSON data. As far as I can know there is no graceful way of handling this. The json input must be validated before sending.
Lili to validate settings in prod.
Output from invalid JSON in production does not show the stacktrace. So this is not a blocker for this sprint. <!DOCTYPE html> <html> <head> <title>We're sorry, but something went wrong (500)</title> <style type="text/css"> body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } div.dialog { width: 25em; padding: 0 4em; margin: 4em auto 0 auto; border: 1px solid #ccc; border-right-color: #999; border-bottom-color: #999; } h1 { font-size: 100%; color: #f00; line-height: 1.5em; } </style> </head> <body> <!-- This file lives in public/500.html --> <div class="dialog"> <h1>We're sorry, but something went wrong.</h1> <p>We've been notified about this issue and we'll take a look at it shortly.</p> </div> </body> </html>
If we decide to fix this in the future I believe "rescue_from MultiJson::DecodeError, ..." will allow us to intercept this parse error. Would need similar logic for other content types.
Should be future featured.
Need to fix or close this
Easy way to reproduce the bug is to pass headers twice to the REST api call. Example: curl -k --user 'ravip:nopass' -H "Accept: application/xml" -H "Content-type: application/json" https://localhost/broker/rest/domains/ravip/applications.xml -X POST -d name=app1 -d cartridge=php-5.3
Priority bumped down a bit.