Fail cleanly when systemd-networkd is not installed#555
Fail cleanly when systemd-networkd is not installed#555slyon merged 2 commits intocanonical:mainfrom
Conversation
|
@slyon is there a reason |
|
Signed the CLA now. |
f771011 to
d20930a
Compare
slyon
left a comment
There was a problem hiding this comment.
Thanks for this improvement!
I left two smaller inline comments below.
@Conan-Kudo IIRC systemd-networkd is not needed in principle for netplan status to function. But it's an implementation detail that we rely on systemd-networkd data heavily (in netplan_cli/cli/state.py:__init__()), besides iproute2 and NetworkManager data.
In theory, it could be changed to use only iproute2 data as ground truth and amend that with systemd-networkd and/or NetworkManager data - whatever is available. And I would be open about that when somebody wants to drive such change.
d20930a to
e371ccd
Compare
`systemctl status` uses the 1-4 exit statuses as defined at https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#Exit%20status `systemctl is-enabled` only exits with 0/1
This has a clean and clear error message instead of a python stack trace if systemd-networkd is not present on the system.
e371ccd to
df94b9e
Compare
|
Rebased PR against |
slyon
left a comment
There was a problem hiding this comment.
Thanks for addressing my remarks. LGTM!
Description
This patch makes the failure case of
netplan statuscleaner when systemd-networkd is not present. This is at least relevant to Fedora/EPEL use-cases.Before:
After:
It also fixes a bug in the
systemctl_is_installeddef.systemctl is-enabledonly returns 1/0 so it needs to usesystemctl statusinstead to be able to use the4exit code to determine if a given service is installed.Checklist
make checksuccessfully.make check-coverage).