From 62c541a2cf88097c134d435f72cd273c96fa4a5d Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 19 Nov 2014 22:29:44 +0000 Subject: [PATCH] It's `urlopen` not `url_open` --- salt/modules/solr.py | 6 +++--- salt/modules/tomcat.py | 6 +++--- salt/modules/zcbuildout.py | 4 ++-- salt/runners/manage.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/salt/modules/solr.py b/salt/modules/solr.py index 92cb27050a..39b530682a 100644 --- a/salt/modules/solr.py +++ b/salt/modules/solr.py @@ -68,7 +68,7 @@ import os # pylint: disable=no-name-in-module,import-error from salt.ext.six import string_types from salt.ext.six.moves.urllib.request import ( - url_open as _url_open, + urlopen as _urlopen, HTTPBasicAuthHandler as _HTTPBasicAuthHandler, HTTPDigestAuthHandler as _HTTPDigestAuthHandler, build_opener as _build_opener, @@ -275,9 +275,9 @@ def _http_request(url, request_timeout=None): request_timeout = __salt__['config.option']('solr.request_timeout') if request_timeout is None: - data = json.load(_url_open(url)) + data = json.load(_urlopen(url)) else: - data = json.load(_url_open(url, timeout=request_timeout)) + data = json.load(_urlopen(url, timeout=request_timeout)) return _get_return_dict(True, data, []) except Exception as err: return _get_return_dict(False, {}, ["{0} : {1}".format(url, err)]) diff --git a/salt/modules/tomcat.py b/salt/modules/tomcat.py index f898e3169b..fc52248f59 100644 --- a/salt/modules/tomcat.py +++ b/salt/modules/tomcat.py @@ -53,7 +53,7 @@ import re # pylint: disable=no-name-in-module,import-error from salt.ext.six.moves.urllib.parse import urlencode as _urlencode from salt.ext.six.moves.urllib.request import ( - url_open as _url_open, + urlopen as _urlopen, HTTPBasicAuthHandler as _HTTPBasicAuthHandler, HTTPDigestAuthHandler as _HTTPDigestAuthHandler, build_opener as _build_opener, @@ -185,11 +185,11 @@ def _wget(cmd, opts=None, url='http://localhost:8080/manager', timeout=180): try: # Trying tomcat >= 7 url - ret['msg'] = _url_open(url, timeout=timeout).read().splitlines() + ret['msg'] = _urlopen(url, timeout=timeout).read().splitlines() except Exception: try: # Trying tomcat6 url - ret['msg'] = _url_open(url6, timeout=timeout).read().splitlines() + ret['msg'] = _urlopen(url6, timeout=timeout).read().splitlines() except Exception: ret['msg'] = 'Failed to create HTTP request' diff --git a/salt/modules/zcbuildout.py b/salt/modules/zcbuildout.py index 6e2a0ba63d..972662ed52 100644 --- a/salt/modules/zcbuildout.py +++ b/salt/modules/zcbuildout.py @@ -37,7 +37,7 @@ import copy # pylint: disable=import-error,no-name-in-module,redefined-builtin from salt.ext.six import string_types, text_type from salt.ext.six.moves import range -from salt.ext.six.moves.urllib.request import url_open as _url_open +from salt.ext.six.moves.urllib.request import urlopen as _urlopen # pylint: enable=import-error,no-name-in-module,redefined-builtin # Import salt libs @@ -526,7 +526,7 @@ def upgrade_bootstrap(directory='.', '{0}.updated_bootstrap'.format(buildout_ver))) except (OSError, IOError): LOG.info('Bootstrap updated from repository') - data = _url_open(booturl).read() + data = _urlopen(booturl).read() updated = True dled = True if 'socket.setdefaulttimeout' not in data: diff --git a/salt/runners/manage.py b/salt/runners/manage.py index 37e08112ab..e0a740177e 100644 --- a/salt/runners/manage.py +++ b/salt/runners/manage.py @@ -14,7 +14,7 @@ import tempfile import time # Import 3rd-party libs -from salt.ext.six.moves.urllib.request import url_open as _url_open # pylint: disable=no-name-in-module,import-error +from salt.ext.six.moves.urllib.request import urlopen as _urlopen # pylint: disable=no-name-in-module,import-error # Import salt libs import salt.key @@ -371,7 +371,7 @@ def bootstrap_psexec(hosts='', master=None, version=None, arch='win32', if not installer_url: base_url = 'http://docs.saltstack.com/downloads/' - source = _url_open(base_url).read() + source = _urlopen(base_url).read() salty_rx = re.compile('>(Salt-Minion-(.+?)-(.+)-Setup.exe)(.*?)\\s*<') source_list = sorted([[path, ver, plat, time.strptime(date, "%d-%b-%Y %H:%M")] for path, ver, plat, date in salty_rx.findall(source)],