summaryrefslogtreecommitdiff
path: root/plugins/modules/vyos_vlan.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/modules/vyos_vlan.py')
-rw-r--r--plugins/modules/vyos_vlan.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/plugins/modules/vyos_vlan.py b/plugins/modules/vyos_vlan.py
index 983a50a..7c3fa69 100644
--- a/plugins/modules/vyos_vlan.py
+++ b/plugins/modules/vyos_vlan.py
@@ -162,18 +162,26 @@ def map_obj_to_commands(updates, module):
for obj in obj_in_have:
for i in obj["interfaces"]:
commands.append(
- "delete interfaces ethernet {0} vif {1}".format(i, vlan_id)
+ "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)
@@ -183,7 +191,9 @@ 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
@@ -215,7 +225,9 @@ 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"
+ ],
}
)
@@ -281,7 +293,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"]