Bug 1163473

Summary: Binary deployment fails if URL contains special characters
Product: OpenShift Container Platform Reporter: thunt
Component: NodeAssignee: Brenton Leanhardt <bleanhar>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 2.2.0CC: bleanhar, jokerman, libra-onpremise-devel, mmccomas, ofayans, xiama
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-openshift-origin-controller-1.33.2.1-1 Doc Type: Bug Fix
Doc Text:
Cause: artifact_url was not properly decoded. Consequence: Deployments using an artifact_url with special characters in the URL would fail. Fix: artifact_url is now properly URI encoded. Result: Deployments using an artifact_url with special characters in the URL now work as expected.
Story Points: ---
Clone Of:
: 1163893 (view as bug list) Environment:
Last Closed: 2015-01-08 15:34:18 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:
Bug Depends On:    
Bug Blocks: 1163893    

Description thunt 2014-11-12 18:58:19 UTC
Description of problem:

Customer is trying to deploy binary artifact with URL of type:

http://jenkins.example.com:13080/ram.ws/oslc/assets/%7B558F2532-1116-50E0-FD2D-7EFCE7F130B3%7D/1.0/artifactContents/201411119-jbossSample1.tar.gz

Broker decodes artifact URL on input to:

http://jenkins.example.com:13080/ram.ws/oslc/assets/{558F2532-1116-50E0-FD2D-7EFCE7F130B3}/1.0/artifactContents/201411119-jbossSample1.tar.gz

The Ruby URI parser in deployments_controller.rb then fails to parse the above decoded URL, and the binary deployment is rejected.

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


How reproducible:
Very

Steps to Reproduce:
See description

Actual results:
URL is rejected as invalid

Expected results:
URL should be deployed

Additional info:

A work around is to double encode the URL, as in:

http://jenkins.example.com:13080/ram.ws/oslc/assets/%257B558F2532-1116-50E0-FD2D-7EFCE7F130B3%257D/1.0/artifactContents/201411119-jbossSample1.tar.gz

Comment 4 Ma xiaoqiang 2014-12-09 09:36:31 UTC
Check on puddle [2.2.z/2014-12-08.2]

1. Create an app and configure it
#rhc app create phpapp php-5.4
#rhc snapshot save phpapp --deployment
#mv phpapp.tar.gz  \<test_123-123\>.tar.gz
#vim index.php
<title>Welcome OpenShift</title>
#git commit -amx && git push 
#rhc snapshot save phpapp
#rhc app-configure -a phpapp --deployment-type binary

2. deploy the app
#rhc app-deploy --ref \<test_123-123\>.tar.gz -a phpapp

3. Check the title
#curl http://phpapp-yes.ose22-auto.com.cn/|grep title
The output is 'Welcome to OpenShift'

4. restore and deploy the app
#rhc snapshot restore phpapp
#curl -k  -H "Accept: application/xml" --user "test:redhat" https://localhost/broker/rest/application/5486a1bb82611d43e0000123/deployments -X POST -d artifact_url=http://virt-openshift-08.lab.eng.nay.redhat.com/%25ad%7bad%7d.tar.gz
URI::encode('%ad{ad}.tar.gz')='%25ad%7bad%7d.tar.gz' 

5. Check the title
#curl http://phpapp-yes.ose22-auto.com.cn/|grep title
The output is 'Welcome to OpenShift'

6. restore and deploy the app
#rhc snapshot restore phpapp
#curl -k  -H "Accept: application/xml" --user "test:redhat" https://localhost/broker/rest/application/5486a1bb82611d43e0000123/deployments -X POST -d artifact_url=http://virt-openshift-08.lab.eng.nay.redhat.com/\<test_123-123\>.tar.gz

7 Check the title
#curl http://phpapp-yes.ose22-auto.com.cn/|grep title
The output is 'Welcome to OpenShift'

Comment 6 errata-xmlrpc 2015-01-08 15:34:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0019.html