summaryrefslogtreecommitdiff
path: root/plugins/module_utils
diff options
context:
space:
mode:
authorGomathiselviS <gomathiselvi@gmail.com>2020-07-24 16:16:03 -0400
committerGitHub <noreply@github.com>2020-07-24 20:16:03 +0000
commitfbb82a0875dacc8200d3f663c3286104d0a1afbf (patch)
treeae507874333cff6aea4e71e4032959e1168eb036 /plugins/module_utils
parenta387c0878535f6af1d19800ff5bb2d60fa2f4e8a (diff)
downloadvyos-ansible-collection-fbb82a0875dacc8200d3f663c3286104d0a1afbf.tar.gz
vyos-ansible-collection-fbb82a0875dacc8200d3f663c3286104d0a1afbf.zip
[vyos] Fix sanity issues (#58)
[vyos] Fix sanity issues Reviewed-by: https://github.com/apps/ansible-zuul
Diffstat (limited to 'plugins/module_utils')
-rw-r--r--plugins/module_utils/network/vyos/argspec/facts/facts.py6
-rw-r--r--plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py2
-rw-r--r--plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py9
-rw-r--r--plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py14
-rw-r--r--plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py2
-rw-r--r--plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py2
-rw-r--r--plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py2
-rw-r--r--plugins/module_utils/network/vyos/facts/legacy/base.py2
-rw-r--r--plugins/module_utils/network/vyos/vyos.py7
10 files changed, 28 insertions, 19 deletions
diff --git a/plugins/module_utils/network/vyos/argspec/facts/facts.py b/plugins/module_utils/network/vyos/argspec/facts/facts.py
index 46fabaa..e52b6eb 100644
--- a/plugins/module_utils/network/vyos/argspec/facts/facts.py
+++ b/plugins/module_utils/network/vyos/argspec/facts/facts.py
@@ -17,6 +17,8 @@ class FactsArgs(object): # pylint: disable=R0903
pass
argument_spec = {
- "gather_subset": dict(default=["!config"], type="list"),
- "gather_network_resources": dict(type="list"),
+ "gather_subset": dict(
+ default=["!config"], type="list", elements="str"
+ ),
+ "gather_network_resources": dict(type="list", elements="str"),
}
diff --git a/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py b/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py
index 6cfdabf..cc124a9 100644
--- a/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py
+++ b/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py
@@ -41,7 +41,7 @@ class Lag_interfacesArgs(object): # pylint: disable=R0903
"arp_monitor": {
"options": {
"interval": {"type": "int"},
- "target": {"type": "list"},
+ "target": {"type": "list", "elements": "str"},
},
"type": "dict",
},
diff --git a/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py b/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py
index 6205fd7..fa41127 100644
--- a/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py
+++ b/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py
@@ -42,6 +42,7 @@ class Lldp_globalArgs(object): # pylint: disable=R0903
"legacy_protocols": {
"choices": ["cdp", "edp", "fdp", "sonmp"],
"type": "list",
+ "elements": "str",
},
"snmp": {"type": "str"},
},
diff --git a/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py b/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py
index b4cdadf..b113035 100644
--- a/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py
+++ b/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py
@@ -210,8 +210,11 @@ class Ospfv2Args(object): # pylint: disable=R0903
},
"type": "dict",
},
- "passive_interface": {"type": "list"},
- "passive_interface_exclude": {"type": "list"},
+ "passive_interface": {"type": "list", "elements": "str"},
+ "passive_interface_exclude": {
+ "type": "list",
+ "elements": "str",
+ },
"redistribute": {
"elements": "dict",
"options": {
@@ -231,7 +234,7 @@ class Ospfv2Args(object): # pylint: disable=R0903
},
"type": "list",
},
- "route_map": {"type": "list"},
+ "route_map": {"type": "list", "elements": "str"},
"timers": {
"options": {
"refresh": {
diff --git a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
index afc9853..f035641 100644
--- a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
+++ b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
@@ -154,16 +154,16 @@ class Firewall_global(ConfigBase):
commands.extend(self._state_replaced(w, h))
return commands
- def _state_replaced(self, want, have):
+ def _state_replaced(self, w, h):
""" The command generator when state is replaced
:rtype: A list
:returns: the commands necessary to migrate the current configuration
to the desired configuration
"""
commands = []
- if have:
- commands.extend(self._state_deleted(have, want))
- commands.extend(self._state_merged(want, have))
+ if h:
+ commands.extend(self._state_deleted(h, w))
+ commands.extend(self._state_merged(w, h))
return commands
def _state_merged(self, want, have):
@@ -275,7 +275,7 @@ class Firewall_global(ConfigBase):
)
)
continue
- elif (
+ if (
key in l_set
and not (h and self._in_target(h, key))
and not self._is_del(l_set, h)
@@ -411,7 +411,7 @@ class Firewall_global(ConfigBase):
):
commands.append(cmd + " " + want["name"])
continue
- elif not (
+ if not (
h and self._in_target(h, key)
) and not self._is_grp_del(h, want, key):
commands.append(
@@ -586,7 +586,7 @@ class Firewall_global(ConfigBase):
)
)
continue
- elif not (
+ if not (
h and self._in_target(h, key)
) and not self._is_del(l_set, h):
commands.append(
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 5c37741..5e38cee 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
@@ -376,7 +376,7 @@ class Firewall_rules(ConfigBase):
)
)
continue
- elif (
+ if (
key == "disabled"
and val
and h
diff --git a/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py b/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py
index fd25c17..c0a4c78 100644
--- a/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py
+++ b/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py
@@ -766,7 +766,7 @@ class Ospfv2(ConfigBase):
):
commands.append(cmd)
continue
- elif key != "area_id" and not _in_target(
+ if key != "area_id" and not _in_target(
h_area, key
):
commands.append(cmd + val + " " + key)
diff --git a/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py b/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py
index acda380..09b9200 100644
--- a/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py
+++ b/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py
@@ -406,7 +406,7 @@ class Ospfv3(ConfigBase):
):
commands.append(cmd)
continue
- elif key != "area_id" and not _in_target(
+ if key != "area_id" and not _in_target(
h_area, key
):
commands.append(cmd + val + " " + key)
diff --git a/plugins/module_utils/network/vyos/facts/legacy/base.py b/plugins/module_utils/network/vyos/facts/legacy/base.py
index f6b343e..a493421 100644
--- a/plugins/module_utils/network/vyos/facts/legacy/base.py
+++ b/plugins/module_utils/network/vyos/facts/legacy/base.py
@@ -126,7 +126,7 @@ class Neighbors(LegacyFactsBase):
for line in data.split("\n"):
if not line:
continue
- elif line[0] == " ":
+ if line[0] == " ":
values += "\n%s" % line
elif line.startswith("Interface"):
if values:
diff --git a/plugins/module_utils/network/vyos/vyos.py b/plugins/module_utils/network/vyos/vyos.py
index 7257b85..4ab36b9 100644
--- a/plugins/module_utils/network/vyos/vyos.py
+++ b/plugins/module_utils/network/vyos/vyos.py
@@ -50,8 +50,11 @@ vyos_provider_spec = {
}
vyos_argument_spec = {
"provider": dict(
- type="dict", options=vyos_provider_spec, removed_in_version=2.14
- ),
+ type="dict",
+ options=vyos_provider_spec,
+ removed_at_date="2022-06-01",
+ removed_from_collection="vyos.vyos",
+ )
}