问题
i am managing a rhel server 6.x which have the Python-2.7.8 installed for an application. When the below chef resource is executed by the chef-client.
execute "/usr/local/bin/python2.7 #{node[:base_dir]}/get-pip.py"
I see the below error in the chef-client log.
[2015-02-24T17:42:27+00:00] ERROR: execute[/usr/local/bin/python2.7 /opt/mount/get-pip.py] (python_app::default line 105) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/local/bin/python2.7 /opt/mount1/get-pip.py ----
STDOUT: Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee268d0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee269d0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee26ad0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee26bd0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee26cd0>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152ee26f50>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152efc4150>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152efc4250>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152efc4350>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f152efc4450>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/pip/
Could not find any downloads that satisfy the requirement pip in /usr/local/lib/python2.7/site-packages
Collecting pip
No distributions at all found for pip in /usr/local/lib/python2.7/site-packages
STDERR:
---- End output of /usr/local/bin/python2.7 /opt/mount1/get-pip.py ----
I am looking up python for this issue. I noticed that there is another version of python. i think this comes with the rhel install.
Python 2.6.6
The python 2.7.8 was install using chef as below:
ark 'python' do
url 'https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz'
path "/opt/mount/"
owner 'python'
action :put
end
execute "cd #{node[:base_dir]}/python && ./configure && make && make altinstall" do
not_if { File.exists?('/usr/local/bin/python2.7') }
end
One thing that i observed is the '/opt/mount/python' is owned by 'root' as against 'python' user.
Any idea why this error messages?
回答1:
The issue was resolved by specifying the proxy info in the execute resource itself as below:
execute "/usr/local/bin/python2.7 #{node[:base_dir]}/get-pip.py --proxy=http://web-proxy.myorganization.com:8080"
来源:https://stackoverflow.com/questions/29155407/connection-to-pypi-python-org-timed-out