summaryrefslogtreecommitdiff
path: root/cloudinit/net/eni.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-08-06 19:33:54 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-08-06 19:33:54 +0000
commit41f508da4f1e421f454136f3c84527a9911c63ff (patch)
tree2f0c8d93881ea3fd0b81ec0b5bb6aa7cefce9905 /cloudinit/net/eni.py
parenta6f95c72259f2890e4a9f9f11166310812173c68 (diff)
downloadvyos-cloud-init-41f508da4f1e421f454136f3c84527a9911c63ff.tar.gz
vyos-cloud-init-41f508da4f1e421f454136f3c84527a9911c63ff.zip
netplan: Correctly render macaddress on a bonds and bridges when provided.
When converting network config v1 to netplan, we were not correctly rendering the 'macaddress' key on a bond. Not that the difference in spelling between v1 'mac_address' and v2 'macaddress' is intentional. Also fixed here is rendering of the macaddress for bridges. LP: #1784699
Diffstat (limited to 'cloudinit/net/eni.py')
-rw-r--r--cloudinit/net/eni.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index bd20a361..80be2429 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -247,8 +247,15 @@ def _parse_deb_config_data(ifaces, contents, src_dir, src_path):
ifaces[currif]['bridge']['ports'] = []
for iface in split[1:]:
ifaces[currif]['bridge']['ports'].append(iface)
- elif option == "bridge_hw" and split[1].lower() == "mac":
- ifaces[currif]['bridge']['mac'] = split[2]
+ elif option == "bridge_hw":
+ # doc is confusing and thus some may put literal 'MAC'
+ # bridge_hw MAC <address>
+ # but correct is:
+ # bridge_hw <address>
+ if split[1].lower() == "mac":
+ ifaces[currif]['bridge']['mac'] = split[2]
+ else:
+ ifaces[currif]['bridge']['mac'] = split[1]
elif option == "bridge_pathcost":
if 'pathcost' not in ifaces[currif]['bridge']:
ifaces[currif]['bridge']['pathcost'] = {}