From 696b68f07a498dc85d281debd55992a49c5bf04a Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Wed, 16 Mar 2016 10:49:21 +0100 Subject: [PATCH] Check return value of get_distribution() On none-Linux systems `get_distribution()` returns `None`, which fails in `fetch_url`, because the return value of `get_distribution()` is not checked before calling `lower()` on the result. --- lib/ansible/module_utils/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py index 51779dc4e1..dd9b76256a 100644 --- a/lib/ansible/module_utils/urls.py +++ b/lib/ansible/module_utils/urls.py @@ -842,7 +842,7 @@ def fetch_url(module, url, data=None, headers=None, method=None, info.update(dict(msg="OK (%s bytes)" % r.headers.get('Content-Length', 'unknown'), status=200)) except NoSSLError, e: distribution = get_distribution() - if distribution.lower() == 'redhat': + if distribution is not None and distribution.lower() == 'redhat': module.fail_json(msg='%s. You can also install python-ssl from EPEL' % str(e)) else: module.fail_json(msg='%s' % str(e))