From 231961564a4bf93d83ae089d663a2d9c27d712cd Mon Sep 17 00:00:00 2001
From: Adam Miller <admiller@redhat.com>
Date: Sun, 12 Aug 2018 09:08:05 +0200
Subject: [PATCH] fix firwewalld permanent zone operations (#42868)

Fixes #42310

Previously, the firewalld module was making a call to
FirewallClientConfig.getZoneNames() which doesn't exist in versions
of firwalld older than 0.4.2, this patch implements the same logic
with older API calls to not require a newer version of firewalld.

Signed-off-by: Adam Miller <admiller@redhat.com>
---
 lib/ansible/modules/system/firewalld.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/ansible/modules/system/firewalld.py b/lib/ansible/modules/system/firewalld.py
index 931b9b866e..240d4290a8 100644
--- a/lib/ansible/modules/system/firewalld.py
+++ b/lib/ansible/modules/system/firewalld.py
@@ -498,7 +498,9 @@ class ZoneTransaction(FirewallTransaction):
         self.module.fail_json(msg=self.tx_not_permanent_error_msg)
 
     def get_enabled_permanent(self):
-        if self.zone in self.fw.config().getZoneNames():
+        zones = self.fw.config().listZones()
+        zone_names = [self.fw.config().getZone(z).get_property("name") for z in zones]
+        if self.zone in zone_names:
             return True
         else:
             return False