mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
added try/catch around .connected call
This commit is contained in:
@@ -194,8 +194,12 @@ def main():
|
||||
timeout = module.params['timeout']
|
||||
|
||||
## Check for firewalld running
|
||||
if fw.connected == False:
|
||||
module.fail_json(msg='firewalld service must be running')
|
||||
try:
|
||||
if fw.connected == False:
|
||||
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:
|
||||
module.fail_json(msg='can only operate on port or service at once')
|
||||
|
||||
Reference in New Issue
Block a user