Bug 1258002

Summary: pip version in python cartridge does not work with proxies
Product: OpenShift Container Platform Reporter: Evgheni Dereveanchin <ederevea>
Component: ImageStreamsAssignee: Vu Dinh <vdinh>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Gaoyun Pei <gpei>
Severity: low Docs Contact:
Priority: medium    
Version: 2.2.0CC: abhgupta, aos-bugs, bparees, ederevea, erich, jokerman, mmccomas, vdinh
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: 2016-05-09 13:47:14 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 Evgheni Dereveanchin 2015-08-28 15:12:08 UTC
Description of problem:

The version of pip (1.4.1) shipped with python-2.7 cartridge is known not to work with proxies

Version-Release number of selected component (if applicable):
openshift-origin-cartridge-python-1.31.3.1-1.el6op.noarch

How reproducible:
always

Steps to Reproduce:
1. create a python app
rhc app create test python-2.7
2. inject HTTP_PROXY env var
rhc env set HTTP_PROXY=http://proxy.hostname.or.ip:3128 --app test
3. add a dependency to requirements.txt
4. push the code

Actual results:
build errors suggesting a certificate mismatch:

remote:   File "/var/lib/openshift/55e04612bafef5286b00000f/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/pip/download.py", line 139, in connect
remote:     match_hostname(self.sock.getpeercert(), self.host)
remote:   File "/var/lib/openshift/55e04612bafef5286b00000f/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/pip/backwardcompat/ssl_match_hostname.py", line 61, in match_hostname
remote:     % (hostname, ', '.join(map(repr, dnsnames))))
remote: CertificateError: hostname 'proxy.hostname.or.ip' doesn't match either of 'www.python.org', 'python.org', 'pypi.python.org', 'docs.python.org', 'testpypi.python.org', 'bugs.python.org', 'wiki.python.org', 'hg.python.org', 'mail.python.org', 'packaging.python.org', 'pythonhosted.org', 'www.pythonhosted.org', 'test.pythonhosted.org', 'us.pycon.org', 'id.python.org'
remote: 
remote: Traceback (most recent call last):


Expected results:
build does not error out

Additional info:
newer versions of pip seem to work properly
the error also goes away as soon as HTTP_PROXY is unset, however this is not applicable for secured environments where there's no direct access to the Internet from gears.