f99bb8c...
by
Chris Patterson <email address hidden>
net/dhcp: surface type of DHCP lease failure to caller (#1276)
When performing DHCP, it is useful for the caller to have context
on the type of failure. This can be done with some new exceptions
types, subclassing NoDHCPLeaseError so the caller's current
contract remains.
- Add the following errors:
- NoDHCPLeaseInterfaceError if there are problems finding
the (possibly specified) interface.
- NoDHCPLeaseMissingDhclientError for missing dhclient.
- Update InvalidDHCPLeaseFileError to subclass NoDHCPLeaseError.
- Pass through these errors rather than catching it in obtain_lease().
Tests:
- Add missing mock for test_provided_nic_does_not_exist().
- Add new test coverage for EphemeralDHCPv4 errors.
- Update existing tests for maybe_perform_dhcp_discovery() to match
new behavior.
Signed-off-by: Chris Patterson <email address hidden>
Expect that "systemctl" is found in the PATH. Using the '/bin' prefix
is very distribution specific. A number of distributions are moving
all executables from '/' to '/usr'.
Fedora currently relies on sysconfig/ifcfg renderer. This is not too great,
because Fedora (also RHEL since version 8) dropped support for the legacy
network service that uses ifcfg files long ago.
In turn, Fedora ended up patching cloud-init downstream to utilize
NetworkManager's ifcfg compatibility mode [1]. This seems to have worked
for a while, nevertheless the NetworkManager's ifcfg backend is reaching
the end of its useful life too [2].
Let's not mangle things downstream and make vanilla cloud-init work great
on Fedora instead.
This also means that the sysconfig compatibility with
Network Manager was removed.
Firstly, this relies upon the fact that you can get ifcfg support by adding
it to NetworkManager.conf. That is not guaranteed and certainly will not
be case in future.
Secondly, cloud-init always generates configuration with
NM_CONTROLLED=no, so the generated ifcfg files are no good for
NetworkManager. Fedora patches around this by just removing those lines
in their cloud-init package.