Bug 1072951

Summary: unable to deploy a binary artifact via REST
Product: OpenShift Online Reporter: Oleg Fayans <ofayans>
Component: MasterAssignee: Dan McPherson <dmcphers>
Status: CLOSED NOTABUG QA Contact: libra bugs <libra-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.xCC: amarecek, dmcphers
Target Milestone: ---Keywords: UpcomingRelease
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-09 19:26:11 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:

Description Oleg Fayans 2014-03-05 13:16:19 UTC
Description of problem:
I am unable to deploy a binary artifact to an app if this artifact is actually hosted in this app

Version-Release number of selected component (if applicable):
devenv_4466 (ami-0b5e5262)

How reproducible:
always

Steps to Reproduce:
1. create a php app
2. make some changes in the app's repo, like echo hello > test.txt
3. git add . ; git commit -am "test" ; git push
4. save a deployment snapshot: 
rhc snapshot-save --deployment -a <%=app_name%>
5. Copy the snapshot file into the app's repo, git commit and push
6. Try to download it and unpack: 
/usr/bin/curl http://<app_name>-<domain_name>.dev.rhcloud.com/<app_name>.tar.gz | /bin/tar -xz (should be downloadable and extractable)
7. Try to deploy it using REST API: 
curl -k -X POST https://ec2-54-211-200-105.compute-1.amazonaws.com/broker/rest/application/531720358351ff670e000069/deployments -d artifact_url=http://app1-lbwjzf.dev.rhcloud.com/app1.tar.gz -u ofayans:redhat

Actual results:

{"api_version":1.6,"data":null,"messages":[{"exit_code":2,"field":null,"index":null,"severity":"debug","text":"Unable to extract deployment archive using command: /usr/bin/curl http://app1-lbwjzf.dev.rhcloud.com/app1.tar.gz | /bin/tar -xz"},{"exit_code":2,"field":null,"index":null,"severity":"error","text":"Unable to complete the requested operation due to: An invalid exit code (2) was returned from the server ip-10-212-107-33.  This indicates an unexpected problem during the execution of your request.\nReference ID: 3db34723125d8c0be54a0a5234610de0"}],"status":"internal_server_error","supported_api_versions":[1.0,1.1,1.2,1.3,1.4,1.5,1.6],"type":null,"version":"1.6"}

Expected results:

Should pass with no problems

Additional info:

Comment 1 Dan McPherson 2014-03-09 19:26:11 UTC
Your issue is you are hosting your snapshot in the same app you are trying to deploy.  So it

Stops the app
Deletes the current content being served (including your tar.gz you are hosting)
Tries to download from http://<app_name>-<domain_name>.dev.rhcloud.com/<app_name>.tar.gz which has been stopped and deleted.
Fails


If you use 2 apps (1 to host your tar and another to deploy to) it works fine.