summaryrefslogtreecommitdiff
path: root/cloudinit/net/eni.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-06-21 10:19:06 -0400
committerScott Moser <smoser@ubuntu.com>2016-06-21 10:19:06 -0400
commit9c006ca13981dcfb01324dbadacda741d5610401 (patch)
treeb6881fbb02f5b552363d97c0983670af8a93c6c9 /cloudinit/net/eni.py
parentd818443bec7fe9c9d5c880f47303b19ce2bc398f (diff)
downloadvyos-cloud-init-9c006ca13981dcfb01324dbadacda741d5610401.tar.gz
vyos-cloud-init-9c006ca13981dcfb01324dbadacda741d5610401.zip
sort attributes in sections, change 'mac_address' to 'hwaddress'
Diffstat (limited to 'cloudinit/net/eni.py')
-rw-r--r--cloudinit/net/eni.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index 1fea240d..bb48a6eb 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -64,7 +64,7 @@ def _iface_add_subnet(iface, subnet):
key = key.replace('_', '-')
content.append(" {} {}".format(key, value))
- return content
+ return sorted(content)
# TODO: switch to valid_map for attrs
@@ -80,16 +80,18 @@ def _iface_add_attrs(iface):
'subnets',
'type',
]
+ renames = {'mac_address': 'hwaddress'}
if iface['type'] not in ['bond', 'bridge', 'vlan']:
ignore_map.append('mac_address')
for key, value in iface.items():
- if value and key not in ignore_map:
- if type(value) == list:
- value = " ".join(value)
- content.append(" {} {}".format(key, value))
+ if not value or key in ignore_map:
+ continue
+ if type(value) == list:
+ value = " ".join(value)
+ content.append(" {} {}".format(renames.get(key, key), value))
- return content
+ return sorted(content)
def _iface_start_entry(iface, index):