summaryrefslogtreecommitdiff
path: root/plugins/modules/vyos_vlan.py
diff options
context:
space:
mode:
authorKate Case <kcase@redhat.com>2023-01-25 08:37:58 -0500
committerGitHub <noreply@github.com>2023-01-25 08:37:58 -0500
commite9911888f6dcdf9031f3fdb2e32c52e45815fdbe (patch)
treedc22abb4a329ef04e98685b81d074679dc24c456 /plugins/modules/vyos_vlan.py
parentbcfe61a3b6ff69f08450f3dbd8f0f1827fb18ab3 (diff)
downloadvyos.vyos-e9911888f6dcdf9031f3fdb2e32c52e45815fdbe.tar.gz
vyos.vyos-e9911888f6dcdf9031f3fdb2e32c52e45815fdbe.zip
Add prettier and isort to pre-commit. (#270)
* Add prettier and isort to pre-commit. * Bump line-length to 100 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'plugins/modules/vyos_vlan.py')
-rw-r--r--plugins/modules/vyos_vlan.py36
1 files changed, 9 insertions, 27 deletions
diff --git a/plugins/modules/vyos_vlan.py b/plugins/modules/vyos_vlan.py
index 83253666..de20d87f 100644
--- a/plugins/modules/vyos_vlan.py
+++ b/plugins/modules/vyos_vlan.py
@@ -164,7 +164,6 @@ commands:
"""
import re
import time
-
from copy import deepcopy
from ansible.module_utils._text import to_text
@@ -173,6 +172,7 @@ from ansible.module_utils.common.validation import check_required_one_of
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import (
remove_default_spec,
)
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
load_config,
run_commands,
@@ -204,27 +204,17 @@ def map_obj_to_commands(updates, module):
if obj_in_have:
for obj in obj_in_have:
for i in obj["interfaces"]:
- commands.append(
- "delete interfaces ethernet {0} vif {1}".format(
- i, vlan_id
- )
- )
+ commands.append("delete interfaces ethernet {0} vif {1}".format(i, vlan_id))
elif state == "present":
if not obj_in_have:
if w["interfaces"] and w["vlan_id"]:
for i in w["interfaces"]:
- cmd = "set interfaces ethernet {0} vif {1}".format(
- i, vlan_id
- )
+ cmd = "set interfaces ethernet {0} vif {1}".format(i, vlan_id)
if w["name"]:
- commands.append(
- cmd + " description {0}".format(name)
- )
+ commands.append(cmd + " description {0}".format(name))
elif w["address"]:
- commands.append(
- cmd + " address {0}".format(address)
- )
+ commands.append(cmd + " address {0}".format(address))
else:
commands.append(cmd)
@@ -234,9 +224,7 @@ def map_obj_to_commands(updates, module):
if not obj_in_want:
for i in h["interfaces"]:
commands.append(
- "delete interfaces ethernet {0} vif {1}".format(
- i, h["vlan_id"]
- )
+ "delete interfaces ethernet {0} vif {1}".format(i, h["vlan_id"])
)
return commands
@@ -271,9 +259,7 @@ def map_params_to_obj(module):
"address": module.params["address"],
"state": module.params["state"],
"interfaces": module.params["interfaces"],
- "associated_interfaces": module.params[
- "associated_interfaces"
- ],
+ "associated_interfaces": module.params["associated_interfaces"],
}
)
@@ -338,13 +324,9 @@ def check_declarative_intent_params(want, module, result):
if w.get("associated_interfaces") is None:
continue
for i in w["associated_interfaces"]:
- if (set(obj_interface) - set(w["associated_interfaces"])) != set(
- []
- ):
+ if (set(obj_interface) - set(w["associated_interfaces"])) != set([]):
module.fail_json(
- msg="Interface {0} not configured on vlan {1}".format(
- i, w["vlan_id"]
- )
+ msg="Interface {0} not configured on vlan {1}".format(i, w["vlan_id"])
)