mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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.
This commit is contained in:
parent
9be6974d37
commit
696b68f07a
1 changed files with 1 additions and 1 deletions
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue