From 9c006ca13981dcfb01324dbadacda741d5610401 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 21 Jun 2016 10:19:06 -0400 Subject: sort attributes in sections, change 'mac_address' to 'hwaddress' --- cloudinit/net/eni.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'cloudinit/net/eni.py') 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): -- cgit v1.2.3