From 4220c3cc30b11351457d7e779cbf5b6a1d9b80f3 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Mon, 9 Sep 2013 10:03:59 -0500 Subject: [PATCH] added try/catch around .connected call --- library/net_infrastructure/firewalld | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/net_infrastructure/firewalld b/library/net_infrastructure/firewalld index 531e48a539c..01d4f3fae6e 100644 --- a/library/net_infrastructure/firewalld +++ b/library/net_infrastructure/firewalld @@ -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')