summaryrefslogtreecommitdiff
path: root/plugins/module_utils/network
diff options
context:
space:
mode:
authorGomathiselviS <gomathiselvi@gmail.com>2022-03-01 11:01:04 -0500
committerGitHub <noreply@github.com>2022-03-01 16:01:04 +0000
commit2299c492ca285f227cdb2043c9602e58ba55bf72 (patch)
tree35bde410f5940aea7337d34808c844e240278ec8 /plugins/module_utils/network
parentb28632c3e581371f3b0d670d376ab409a4b8fa0e (diff)
downloadvyos-ansible-collection-2299c492ca285f227cdb2043c9602e58ba55bf72.tar.gz
vyos-ansible-collection-2299c492ca285f227cdb2043c9602e58ba55bf72.zip
Change parameter 'disabled' to 'disable' in test_vyos_firewall_rules.py (#240)
Change parameter 'disabled' to 'disable' in test_vyos_firewall_rules.py SUMMARY Fixes #239 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com> Reviewed-by: Sagar Paul <sagpaul@redhat.com> Reviewed-by: GomathiselviS <None> Reviewed-by: Rohit Thakur <rohitthakur2590@outlook.com> Reviewed-by: None <None>
Diffstat (limited to 'plugins/module_utils/network')
-rw-r--r--plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py5
-rw-r--r--plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py10
-rw-r--r--plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py6
3 files changed, 14 insertions, 7 deletions
diff --git a/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py
index 22dc8f7..61d9a55 100644
--- a/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py
+++ b/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py
@@ -87,7 +87,10 @@ class Firewall_rulesArgs(object): # pylint: disable=R0903
},
"type": "dict",
},
- "disabled": {"type": "bool"},
+ "disable": {
+ "type": "bool",
+ "aliases": ["disabled"],
+ },
"fragment": {
"choices": [
"match-frag",
diff --git a/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
index 22973bd..2920878 100644
--- a/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
+++ b/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
@@ -358,7 +358,7 @@ class Firewall_rules(ConfigBase):
"number",
"protocol",
"fragment",
- "disabled",
+ "disable",
"description",
"log",
)
@@ -375,7 +375,7 @@ class Firewall_rules(ConfigBase):
and key in l_set
and not (h and self._is_w_same(w, h, key))
):
- if key == "disabled":
+ if key == "disable":
if not (
not val
and (not h or key not in h or not h[key])
@@ -398,7 +398,7 @@ class Firewall_rules(ConfigBase):
)
continue
if (
- key == "disabled"
+ key == "disable"
and val
and h
and (key not in h or not h[key])
@@ -924,7 +924,7 @@ class Firewall_rules(ConfigBase):
value
and opr
and attrib != "enable_default_log"
- and attrib != "disabled"
+ and attrib != "disable"
):
cmd += " '" + str(value) + "'"
return cmd
@@ -1033,7 +1033,7 @@ class Firewall_rules(ConfigBase):
"action",
"fragment",
"protocol",
- "disabled",
+ "disable",
"description",
"mac_address",
"default_action",
diff --git a/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py
index f1c080f..cb1d4bb 100644
--- a/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py
+++ b/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py
@@ -168,7 +168,7 @@ class Firewall_rulesFacts(object):
"action",
"protocol",
"fragment",
- "disabled",
+ "disable",
"description",
"icmp",
]
@@ -341,10 +341,14 @@ class Firewall_rulesFacts(object):
config[attrib] = True
else:
out = search(r"^.*" + regex + " (.+)", conf, M)
+ if not out and attrib == "disable":
+ out = search(r"^.*\d+" + " ('disable'$)", conf, M)
if out:
val = out.group(1).strip("'")
if self.is_num(attrib):
val = int(val)
+ if attrib == "disable":
+ val = True
config[attrib] = val
return config