summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2017-05-26 14:29:24 -0500
committerScott Moser <smoser@brickies.net>2017-05-31 13:14:38 -0400
commit00b678c61a54f176625d3f937971215faf6af2cd (patch)
treec7ab306ad5a9e1128d57c3a1cbaf16bb744af798 /cloudinit/net
parent003c6678e9c873b3b787a814016872b6592f5069 (diff)
downloadvyos-cloud-init-00b678c61a54f176625d3f937971215faf6af2cd.tar.gz
vyos-cloud-init-00b678c61a54f176625d3f937971215faf6af2cd.zip
Fix eni rendering for bridge params that require repeated key for values.
There are a few bridge parameters which require repeating the key with each value in the list when rendering eni. Extend the network unittests to cover all of the known bridge parameters and check we render eni and netplan correctly.
Diffstat (limited to 'cloudinit/net')
-rw-r--r--cloudinit/net/eni.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index 0cc4e3b2..20e19f5b 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -75,6 +75,15 @@ def _iface_add_attrs(iface, index):
'subnets',
'type',
]
+
+ # The following parameters require repetitive entries of the key for
+ # each of the values
+ multiline_keys = [
+ 'bridge_pathcost',
+ 'bridge_portprio',
+ 'bridge_waitport',
+ ]
+
renames = {'mac_address': 'hwaddress'}
if iface['type'] not in ['bond', 'bridge', 'vlan']:
ignore_map.append('mac_address')
@@ -82,6 +91,10 @@ def _iface_add_attrs(iface, index):
for key, value in iface.items():
if not value or key in ignore_map:
continue
+ if key in multiline_keys:
+ for v in value:
+ content.append(" {0} {1}".format(renames.get(key, key), v))
+ continue
if type(value) == list:
value = " ".join(value)
content.append(" {0} {1}".format(renames.get(key, key), value))