cloudinit/net/sysconfig.py does not parse network_data.json correctly

Bug #1665441 reported by Lars Kellogg-Stedman on 2017-02-16
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Medium
Lars Kellogg-Stedman

Bug Description

In cloudinit/net/sysconfig.py, we see:

            elif len(iface_subnets) > 1:
                for i, iface_subnet in enumerate(iface_subnets,
                                                 start=len(iface.children)):
                    iface_sub_cfg = iface_cfg.copy()
                    iface_sub_cfg.name = "%s:%s" % (iface_name, i)
                    iface.children.append(iface_sub_cfg)
                    cls._render_subnet(iface_sub_cfg, route_cfg, iface_subnet)

The code 'start=len(iface.children)' fails because at this point, iface is simply a dict, and has no 'children' attribute.

Related branches

Lars Kellogg-Stedman (larsks) wrote :

I am working on a fix in https://code.launchpad.net/~larsks/cloud-init/+git/cloud-init/+ref/lp/1665441. That branch right now will run without errors but the resulting config file appears to be missing an ip address.

Lars Kellogg-Stedman (larsks) wrote :

I've gone ahead and proposed the fix for merging. It results in interface config files that are correct but that will only work with legacy (pre-NetworkManager) networking until https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=a8f0d88596d8dd2b807a7b0adee272c4f077dade reaches centos/rhel/etc packaging.

Changed in cloud-init:
assignee: nobody → Lars Kellogg-Stedman (larsks)
status: New → Confirmed
Changed in cloud-init:
status: Confirmed → Fix Committed
Scott Moser (smoser) on 2017-07-03
Changed in cloud-init:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers