diff --git a/changelogs/fragments/64076-urls-timeout-parameter.yml b/changelogs/fragments/64076-urls-timeout-parameter.yml new file mode 100644 index 00000000000..e3728b87089 --- /dev/null +++ b/changelogs/fragments/64076-urls-timeout-parameter.yml @@ -0,0 +1,2 @@ +bugfixes: + - core - remove unneeded Python version checks. diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py index 07332dab260..a13e985abdf 100644 --- a/lib/ansible/module_utils/urls.py +++ b/lib/ansible/module_utils/urls.py @@ -1285,14 +1285,7 @@ class Request: else: request.add_header(header, headers[header]) - urlopen_args = [request, None] - if sys.version_info >= (2, 6, 0): - # urlopen in python prior to 2.6.0 did not - # have a timeout parameter - urlopen_args.append(timeout) - - r = urllib_request.urlopen(*urlopen_args) - return r + return urllib_request.urlopen(request, None, timeout) def get(self, url, **kwargs): r"""Sends a GET request. Returns :class:`HTTPResponse` object. diff --git a/lib/ansible/modules/files/find.py b/lib/ansible/modules/files/find.py index b516c4fbbe8..252cfb7e23e 100644 --- a/lib/ansible/modules/files/find.py +++ b/lib/ansible/modules/files/find.py @@ -216,7 +216,6 @@ import os import pwd import re import stat -import sys import time from ansible.module_utils.basic import AnsibleModule @@ -409,8 +408,7 @@ def main(): for npath in params['paths']: npath = os.path.expanduser(os.path.expandvars(npath)) if os.path.isdir(npath): - ''' ignore followlinks for python version < 2.6 ''' - for root, dirs, files in (sys.version_info < (2, 6, 0) and os.walk(npath)) or os.walk(npath, followlinks=params['follow']): + for root, dirs, files in os.walk(npath, followlinks=params['follow']): if params['depth']: depth = root.replace(npath.rstrip(os.path.sep), '').count(os.path.sep) if files or dirs: