mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
remove hard coded requirements for pycurl, change curl_httpclient to be optional unless proxy_host/port is set
This commit is contained in:
parent
c5dcad0bcf
commit
54ed2378ce
3 changed files with 12 additions and 11 deletions
|
@ -6,4 +6,3 @@ requests>=1.0.0
|
|||
tornado>=4.2.1
|
||||
# Required by Tornado to handle threads stuff.
|
||||
futures>=2.0
|
||||
pycurl>=7.19.3
|
||||
|
|
|
@ -2530,7 +2530,6 @@ install_debian_8_git_deps() {
|
|||
__REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
|
||||
if [ "${__REQUIRED_TORNADO}" != "" ]; then
|
||||
__apt_get_install_noinput python-tornado
|
||||
__apt_get_install_noinput python-pycurl
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -2788,7 +2787,6 @@ install_fedora_git_deps() {
|
|||
__REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
|
||||
if [ "${__REQUIRED_TORNADO}" != "" ]; then
|
||||
$FEDORA_PACKAGE_MANAGER install -y python-tornado
|
||||
$FEDORA_PACKAGE_MANAGER install -y python-pycurl
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -3006,10 +3004,8 @@ install_centos_stable_deps() {
|
|||
if [ "${__REQUIRED_TORNADO}" != "" ]; then
|
||||
if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then
|
||||
yum install -y python26-tornado
|
||||
yum install -y python26-pycurl
|
||||
else
|
||||
yum install -y python-tornado
|
||||
yum install -y python-pycurl
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -3151,10 +3147,8 @@ install_centos_git_deps() {
|
|||
if [ "${__REQUIRED_TORNADO}" != "" ]; then
|
||||
if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then
|
||||
yum install -y python26-tornado
|
||||
yum install -y python26-pycurl
|
||||
else
|
||||
yum install -y python-tornado
|
||||
yum install -y python-pycurl
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -3798,7 +3792,6 @@ install_amazon_linux_ami_git_deps() {
|
|||
__REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
|
||||
if [ "${__REQUIRED_TORNADO}" != "" ]; then
|
||||
yum install -y python-tornado
|
||||
yum install -y python-pycurl
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -4620,7 +4613,6 @@ install_opensuse_git_deps() {
|
|||
__REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
|
||||
if [ "${__REQUIRED_TORNADO}" != "" ]; then
|
||||
__zypper_install python-tornado
|
||||
__zypper_install python-pycurl
|
||||
fi
|
||||
|
||||
fi
|
||||
|
@ -4860,7 +4852,6 @@ install_suse_11_git_deps() {
|
|||
__REQUIRED_TORNADO="$(grep tornado "${__SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
|
||||
if [ "${__REQUIRED_TORNADO}" != "" ]; then
|
||||
__zypper_install python-tornado
|
||||
__zypper_install python-pycurl
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -56,9 +56,14 @@ from salt.ext.six.moves.urllib.error import URLError
|
|||
# Don't need a try/except block, since Salt depends on tornado
|
||||
import tornado.httputil
|
||||
import tornado.simple_httpclient
|
||||
import tornado.curl_httpclient
|
||||
from tornado.httpclient import HTTPClient
|
||||
|
||||
try:
|
||||
import tornado.curl_httpclient
|
||||
HAS_CURL_HTTPCLIENT = True
|
||||
except:
|
||||
HAS_CURL_HTTPCLIENT = False
|
||||
|
||||
try:
|
||||
import requests
|
||||
HAS_REQUESTS = True
|
||||
|
@ -432,6 +437,12 @@ def query(url,
|
|||
|
||||
# We want to use curl_http if we have a proxy defined
|
||||
if proxy_host and proxy_port:
|
||||
if HAS_CURL_HTTPCLIENT is False:
|
||||
ret['error'] = ('proxy_host and proxy_port has been set. This requires pycurl, but the '
|
||||
'pycurl library does not seem to be installed')
|
||||
log.error(ret['error'])
|
||||
return ret
|
||||
|
||||
tornado.httpclient.AsyncHTTPClient.configure('tornado.curl_httpclient.CurlAsyncHTTPClient')
|
||||
client_argspec = inspect.getargspec(tornado.curl_httpclient.CurlAsyncHTTPClient.initialize)
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue