summaryrefslogtreecommitdiff
path: root/plugins/modules/vyos_vlan.py
diff options
context:
space:
mode:
authoransible-zuul[bot] <48994755+ansible-zuul[bot]@users.noreply.github.com>2019-08-09 19:11:48 +0000
committerGitHub <noreply@github.com>2019-08-09 19:11:48 +0000
commit66a01fb3cdcedff9205b2295870a7e1629bbae69 (patch)
treebe8d5d5490ec5c49a2f33b83184e35d58d635895 /plugins/modules/vyos_vlan.py
parentfbe294b702e757252a66f64edf66bce060e87494 (diff)
parent29c342fa51c7a9866366cfc20968be7270e02fc5 (diff)
downloadvyos.vyos-66a01fb3cdcedff9205b2295870a7e1629bbae69.tar.gz
vyos.vyos-66a01fb3cdcedff9205b2295870a7e1629bbae69.zip
Merge pull request #10 from ansible-network/bt_79
79 Reviewed-by: Paul Belanger https://github.com/pabelanger
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"]