Fix for ansible-modules-extras issue #1080
This commit is contained in:
parent
0b12f35f61
commit
67cd464ac7
1 changed files with 7 additions and 0 deletions
|
@ -95,6 +95,7 @@ try:
|
||||||
import firewall.config
|
import firewall.config
|
||||||
FW_VERSION = firewall.config.VERSION
|
FW_VERSION = firewall.config.VERSION
|
||||||
|
|
||||||
|
from firewall.client import Rich_Rule
|
||||||
from firewall.client import FirewallClient
|
from firewall.client import FirewallClient
|
||||||
fw = FirewallClient()
|
fw = FirewallClient()
|
||||||
HAS_FIREWALLD = True
|
HAS_FIREWALLD = True
|
||||||
|
@ -199,6 +200,9 @@ def set_service_disabled_permanent(zone, service):
|
||||||
# rich rule handling
|
# rich rule handling
|
||||||
#
|
#
|
||||||
def get_rich_rule_enabled(zone, rule):
|
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):
|
if rule in fw.getRichRules(zone):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
@ -213,6 +217,9 @@ def set_rich_rule_disabled(zone, rule):
|
||||||
def get_rich_rule_enabled_permanent(zone, rule):
|
def get_rich_rule_enabled_permanent(zone, rule):
|
||||||
fw_zone = fw.config().getZoneByName(zone)
|
fw_zone = fw.config().getZoneByName(zone)
|
||||||
fw_settings = fw_zone.getSettings()
|
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():
|
if rule in fw_settings.getRichRules():
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue