Merge pull request #1081 from ag-wood/firewalld-rr-fix

Fix for - Firewalld traces with ALREADY_ENABLED when using port name or re-ordered rich rule
This commit is contained in:
Brian Coca 2016-01-04 09:21:46 -05:00
commit 82a4cf84be

View file

@ -96,6 +96,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
@ -200,6 +201,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:
@ -214,6 +218,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: