mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
added try/catch around .connected call
This commit is contained in:
parent
50adda5096
commit
4220c3cc30
1 changed files with 6 additions and 2 deletions
|
@ -194,8 +194,12 @@ def main():
|
||||||
timeout = module.params['timeout']
|
timeout = module.params['timeout']
|
||||||
|
|
||||||
## Check for firewalld running
|
## Check for firewalld running
|
||||||
|
try:
|
||||||
if fw.connected == False:
|
if fw.connected == False:
|
||||||
module.fail_json(msg='firewalld service must be running')
|
module.fail_json(msg='firewalld service must be running')
|
||||||
|
except AttributeError:
|
||||||
|
module.fail_json(msg="firewalld connection can't be established,\
|
||||||
|
version likely too old. Requires firewalld >= 2.0.11")
|
||||||
|
|
||||||
if service != None and port != None:
|
if service != None and port != None:
|
||||||
module.fail_json(msg='can only operate on port or service at once')
|
module.fail_json(msg='can only operate on port or service at once')
|
||||||
|
|
Loading…
Reference in a new issue