Bug 829452

Summary: Error when creating an application if git repo doesn't exist
Product: OKD Reporter: Fotios Lindiakos <fotios>
Component: ContainersAssignee: Rob Millner <rmillner>
Status: CLOSED DUPLICATE QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 2.xCC: jkeck, mfisher, qgong, xtian, yujzhang
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: 2013-01-22 19:54:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The broker log none

Description Fotios Lindiakos 2012-06-06 19:26:23 UTC
Description of problem:
When creating an application from a template, if there is a problem during the git clone step, the application creation fails hard without a useful error message.

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


How reproducible:
Always (if the template has a bad git url)

Steps to Reproduce:
1. Create a template with a bad git url
2. Create an application from that template
3.
  
Actual results:
Generic Node Execution failure message
The broker log shows:
DEBUG: server results: Clonong git repository from remote 'git://github.com/linickx/wordpress-example.git'.
DEBUG: server results: fatal: remote error:
DEBUG: server results:   Repository not found.
DEBUG: server results: Initialized empty Git repository in /var/lib/stickshift/35a024a3aca64f568126867e4d37f8cb/git/drupal.git/
DEBUG: Cartridge command php-5.3::configure exitcode = 128

Expected results:
Error message stating something about the git repo not being available.


Additional info:

Comment 1 Rob Millner 2012-06-08 18:05:47 UTC
An early test should be done to validate the git repo is reachable and valid before any creation starts.

Comment 2 Rob Millner 2012-06-13 20:42:42 UTC
Added verification to the remote cloning command to stop and print a helpful error message if the remote clone fails.

Crankcase commit 21d8924bd9.

Waiting on pull request #123.

Comment 3 Rob Millner 2012-06-14 00:09:41 UTC
Moved to pull request #126.

Comment 4 Xiaoli Tian 2012-06-18 10:17:30 UTC
Tested this on devenv_1850 with the following steps, it still failed with Node execution failure.

1. Create an template with wrong git url like:
#rhc-admin-ctl-template -c add -d /tmp/des.yaml -g git://github.com/openshift/wordpress-example1.git -t testword --cost 1 -m '{"name1":"me"}'
return:  4ba9919e4a0440a3a9b1d2c82cef882a

2. Create an app with the template:
curl -k -X POST -H "Accept: application/xml" -H "Content-type: application/json" -d '{name:"myapp1", template: 4ba9919e4a0440a3a9b1d2c82cef882a}' --user xtian+t100:xx https://ec2-23-22-75-68.compute-1.amazonaws.com/broker/rest/domains/domainxdev02/applications

Error shown in the response of RESTAPI:
 <severity>error</severity>
      <field nil="true"></field>
      <text>Failed to create application myapp1 due to:Node execution failure (invalid exit code from node).  If the problem persists please contact Red Hat support.</text>
      <exit-code>143</exit-code>

Error in broker log:

DEBUG: server results: Cloning git repository from remote 'git://github.com/openshift/wordpress-example1.git'.
DEBUG: server results: fatal: remote error: 
DEBUG: server results:   Repository not found.
DEBUG: server results: Initialized empty Git repository in /var/lib/stickshift/1bcb9fd6445b454087ac34db7df2b941/git/myapp1.git/
DEBUG: Cartridge command php-5.3::configure exitcode = 128
Node execution failure (invalid exit code from node).  If the problem persists please contact Red Hat support.
#<StickShift::NodeException: Node execution failure (invalid exit code from node).  If the problem persists please contact Red Hat support.>

Comment 5 Rob Millner 2012-06-19 00:43:58 UTC
Ok, I see the problem. The error message is being suppressed both because the calling hook runs with "set -e" to exit on the first error and because the exception in broker isn't designed to bring better information to the surface.

Taking this ticket out of being a release blocker.  It only affects administrators creating new templates.  And we need to work out the changes needed to bring better mcollective error reporting up through the broker.

Comment 6 Yujie Zhang 2013-01-08 06:13:38 UTC
Tested this bug on devenv_2640 today with the following steps:

1.Go to openshift website and login
2.Try to create an application with invalid input of source code field like "asdfasdf"

Actual results:

Caught server error like "We appear to be having technical difficulties.".

The log of site is as following:
2013-01-08 00:43:31.534 [DEBUG] OpenShift API (7153.9ms) post https://localhost:443/broker/rest/domains/aaaa3434/applications.json [ code: 500 ] (pid:4024)
2013-01-08 00:43:31.538 [DEBUG] Server error: : #128: (pid:4024)
2013-01-08 00:43:31.539 [DEBUG] Found errors on the response object: {} (pid:4024)
2013-01-08 00:43:31.628 [ERROR] Unhandled exception reference #aad43ac456900be13ad68bdde7bcd410: Failed.  Response code = 500.  Response message = Internal Server Error.
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-console-1.3.2/lib/active_resource/persistent_connection.rb:209:in `handle_response'
  /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-console-1.3.2/lib/active_resource/persistent_connection.rb:172:in `request'
  /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-console-1.3.2/lib/active_resource/persistent_connection.rb:127:in `block in post'
  /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-console-1.3.2/lib/active_resource/persistent_connection.rb:275:in `with_auth'
  /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-console-1.3.2/lib/active_resource/persistent_connection.rb:127:in `post'
  /opt/rh/ruby193/root/usr/share/gems/gems/activeresource-3.2.8/lib/active_resource/base.rb:1360:in `create'

Comment 7 Yujie Zhang 2013-01-08 06:22:14 UTC
Created attachment 674514 [details]
The broker log

Comment 8 Rob Millner 2013-01-22 19:54:38 UTC

*** This bug has been marked as a duplicate of bug 896364 ***