From 8824a8fe237b90c31ede5cea14b94bb768b2bc7a Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 3 Mar 2018 22:59:10 -0500 Subject: [PATCH] Assume firewall is offline on DBUS_ERROR during init (#36486) During init, the FirewallClient tries to connect to the DBUS socket. If it fails to connect it should be safe to assume firewalld is offline. --- lib/ansible/modules/system/firewalld.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/system/firewalld.py b/lib/ansible/modules/system/firewalld.py index 33e3d21a3a..cb5ef01f7c 100644 --- a/lib/ansible/modules/system/firewalld.py +++ b/lib/ansible/modules/system/firewalld.py @@ -164,6 +164,7 @@ try: from firewall.client import Rich_Rule from firewall.client import FirewallClient from firewall.client import FirewallClientZoneSettings + from firewall.errors import FirewallError fw = None fw_offline = False import_failure = False @@ -171,7 +172,7 @@ try: try: fw = FirewallClient() fw.getDefaultZone() - except AttributeError: + except (AttributeError, FirewallError): # Firewalld is not currently running, permanent-only operations fw_offline = True