From 67cd464ac7435af96d25d8efcb583d2a3a62d37b Mon Sep 17 00:00:00 2001 From: ag-wood Date: Sun, 11 Oct 2015 23:17:23 +1000 Subject: [PATCH] Fix for ansible-modules-extras issue #1080 --- lib/ansible/modules/extras/system/firewalld.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ansible/modules/extras/system/firewalld.py b/lib/ansible/modules/extras/system/firewalld.py index b9840530b0..0da738f01c 100644 --- a/lib/ansible/modules/extras/system/firewalld.py +++ b/lib/ansible/modules/extras/system/firewalld.py @@ -95,6 +95,7 @@ try: import firewall.config FW_VERSION = firewall.config.VERSION + from firewall.client import Rich_Rule from firewall.client import FirewallClient fw = FirewallClient() HAS_FIREWALLD = True @@ -199,6 +200,9 @@ def set_service_disabled_permanent(zone, service): # rich rule handling # def get_rich_rule_enabled(zone, rule): + # Convert the rule string to standard format + # before checking whether it is present + rule = str(Rich_Rule(rule_str=rule)) if rule in fw.getRichRules(zone): return True else: @@ -213,6 +217,9 @@ def set_rich_rule_disabled(zone, rule): def get_rich_rule_enabled_permanent(zone, rule): fw_zone = fw.config().getZoneByName(zone) fw_settings = fw_zone.getSettings() + # Convert the rule string to standard format + # before checking whether it is present + rule = str(Rich_Rule(rule_str=rule)) if rule in fw_settings.getRichRules(): return True else: