diff options
Diffstat (limited to 'cloudinit/net/networkd.py')
-rw-r--r-- | cloudinit/net/networkd.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/cloudinit/net/networkd.py b/cloudinit/net/networkd.py index ee6fd2ad..c97c18f6 100644 --- a/cloudinit/net/networkd.py +++ b/cloudinit/net/networkd.py @@ -41,11 +41,11 @@ class CfgParser: def get_final_conf(self): contents = '' - for k, v in self.conf_dict.items(): + for k, v in sorted(self.conf_dict.items()): if not v: continue contents += '['+k+']\n' - for e in v: + for e in sorted(v): contents += e + '\n' contents += '\n' @@ -242,6 +242,19 @@ class Renderer(renderer.Renderer): name = iface['name'] # network state doesn't give dhcp domain info # using ns.config as a workaround here + + # Check to see if this interface matches against an interface + # from the network state that specified a set-name directive. + # If there is a device with a set-name directive and it has + # set-name value that matches the current name, then update the + # current name to the device's name. That will be the value in + # the ns.config['ethernets'] dict below. + for dev_name, dev_cfg in ns.config['ethernets'].items(): + if 'set-name' in dev_cfg: + if dev_cfg.get('set-name') == name: + name = dev_name + break + self.dhcp_domain(ns.config['ethernets'][name], cfg) ret_dict.update({link: cfg.get_final_conf()}) |