Bug in generated network config v1

There’s a bug in the generated network config v1 format. I’ve opened this bug report with the details Bug #2083540 “MaaS creates invalid network config v1 for unconfi...” : Bugs : MAAS

It would appear to be a simple enough problem. If you do not configure a physical interface (say because it’s not in use) the generated config looks like this

- id: enp129s0f1
    mac_address: 34:80:0d:aa:bb:cc
    mtu: 1500
    name: enp129s0f1
    subnets:
    - type: manual

Cloud-init rejects this as invalid:

config.1.subnets.0.type: 'manual' is not one of ['dhcp4', 'dhcp', 'dhcp6', 'static', 'static6', 'ipv6_dhcpv6-stateful', 'ipv6_dhcpv6-stateless', 'ipv6_slaac']

The documentation at https://cloudinit.readthedocs.io/en/latest/reference/network-config-format-v1.html#subnet-ip seems to indicate that the correct configuration might be

    subnets:
    - type: static
      control: manual

Other than generating the correct config, I have another opposing question… why generate a configuration for this interface at all? Why not leave it out of the cloud-init network configuration? When it is left unconfigured, why write anything?

Let’s follow up on the bug