summaryrefslogtreecommitdiff
path: root/plugins/modules/vyos_vlan.py
diff options
context:
space:
mode:
authorBradley A. Thornton <bthornto@thethorntons.net>2019-08-09 12:05:55 -0700
committerBradley A. Thornton <bthornto@thethorntons.net>2019-08-09 12:05:55 -0700
commit29c342fa51c7a9866366cfc20968be7270e02fc5 (patch)
tree196722c57cca4211e79781edefe1a101d9c4b0c5 /plugins/modules/vyos_vlan.py
parent5fb9df4e907a6ab2da7a6c2dafdec9c1971e8d44 (diff)
downloadvyos-ansible-old-29c342fa51c7a9866366cfc20968be7270e02fc5.tar.gz
vyos-ansible-old-29c342fa51c7a9866366cfc20968be7270e02fc5.zip
79
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"]