Merge pull request #14989 from nifoc/patch-fetch_url

Check return value of get_distribution()
This commit is contained in:
Brian Coca 2016-03-16 16:54:11 -07:00
commit d7d47bcd75

View file

@ -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)) info.update(dict(msg="OK (%s bytes)" % r.headers.get('Content-Length', 'unknown'), status=200))
except NoSSLError, e: except NoSSLError, e:
distribution = get_distribution() 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)) module.fail_json(msg='%s. You can also install python-ssl from EPEL' % str(e))
else: else:
module.fail_json(msg='%s' % str(e)) module.fail_json(msg='%s' % str(e))