Commit 7282ab2d authored by Alexander Kruppa's avatar Alexander Kruppa

Catch OSError when looking for wget/curl

parent 223c2fdb
......@@ -593,8 +593,10 @@ class WorkunitClient(object):
return urllib_request.urlopen(request, cafile=cafile)
# Python 2 urllib does not implement certificate checks.
# FIXME: We need a work-around.
# For the time being, we just use HTTPS without check
# For the time being, we just use HTTPS without check.
# We should never get here, as we use wget or curl as
# fall-backs under Python 2, and if neither is available,
# aborts in the initialisation phase.
return urllib_request.urlopen(request)
# If we are not using HTTPS, we can just let urllib do it,
......@@ -624,7 +626,7 @@ class WorkunitClient(object):
if not conn:
logging.error("%s of result failed, %s",
logging.error("%s failed, %s",
'Upload' if is_upload else 'Download',
logging.error("Waiting %s seconds before retrying", wait)
......@@ -1067,9 +1069,15 @@ if __name__ == '__main__':
# Can we download with HTTPS at all?
if sys.version_info[0] == 2:
HAVE_WGET = run_command(["wget", "-V"])[0] == 0
HAVE_WGET = run_command(["wget", "-V"])[0] == 0
except OSError:
if not HAVE_WGET:
HAVE_CURL = run_command(["curl", "-V"])[0] == 0
HAVE_CURL = run_command(["curl", "-V"])[0] == 0
except OSError:
if not HAVE_WGET and not HAVE_CURL:
logging.critical("HTTPS requested, but not implemented in "
"Python 2 and can't find wget or curl as fall-back. "
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment