1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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.
This commit is contained in:
John Smith 2018-03-03 22:59:10 -05:00 committed by Adam Miller
parent 83aaa8137a
commit 8824a8fe23

View file

@ -164,6 +164,7 @@ try:
from firewall.client import Rich_Rule from firewall.client import Rich_Rule
from firewall.client import FirewallClient from firewall.client import FirewallClient
from firewall.client import FirewallClientZoneSettings from firewall.client import FirewallClientZoneSettings
from firewall.errors import FirewallError
fw = None fw = None
fw_offline = False fw_offline = False
import_failure = False import_failure = False
@ -171,7 +172,7 @@ try:
try: try:
fw = FirewallClient() fw = FirewallClient()
fw.getDefaultZone() fw.getDefaultZone()
except AttributeError: except (AttributeError, FirewallError):
# Firewalld is not currently running, permanent-only operations # Firewalld is not currently running, permanent-only operations
fw_offline = True fw_offline = True