This PR adds a new io.netplan.Netplan dbus activatable service
that can be used to Apply a netplan configuration.
The main use-case for this is Ubuntu Core where we want to allow
snaps to control the netplan network configuration via an interface.
However we do not want to give access to systemctl to restart
systemd-networkd or network-manager. The dbus service will run
outside of the confinement will archive this goal.
The interface is probably useful beyond Ubuntu Core.
When using the NetworkManager renderer, the logic in
`NetplanApply.command_apply()` tells `nmcli` to disconnect the devices
previously populated by `netifaces.interfaces()`.
In addition, if an alias like "eth0:0" exists, it will show as a device
from `netifaces.interfaces()` but will not have a path in
`/sys/class/net`.
This means that the `devices` variable may have more devices than
actually exist due to the past `nmcli device disconnect` run or the
presence of one or more aliases.
The attached patch fixes this bug by tolerating all errors from `udevadm
test-builtin net_setup_link /sys/class/net/XXX` so that `netplan apply`
doesn't quit and leave the user without a network setup.
parser: refactor / factor out validation and error reporting
Move validation and error reporting to their own files; also rework
the validation passes slightly to validate as much as we can of the
netplan grammar in parser passes (so we get context info for errors),
and leave the backend rules sanity checking only to after the parsing.
This way we'll get the error context, unless things are backend-specific
rules for which it's just hard to get the info (and not as helpful).