-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve D-Bus error handling for NetworkManager (#4720)
* Improve D-Bus error handling for NetworkManager There are quite some errors captured which are related by seemingly a suddenly missing NetworkManager. Errors appear as: 23-11-21 17:42:50 ERROR (MainThread) [supervisor.dbus.network] Error while processing /org/freedesktop/NetworkManager/Devices/10: Remote peer disconnected ... 23-11-21 17:42:50 ERROR (MainThread) [supervisor.dbus.network] Error while processing /org/freedesktop/NetworkManager/Devices/35: The name is not activatable Both errors seem to already happen at introspection time, however the current code doesn't converts these errors to Supervisor issues. This PR uses the already existing `DBus.from_dbus_error()`. Furthermore this adds a new Exception `DBusNoReplyError` for the `ErrorType.NO_REPLY` (or `org.freedesktop.DBus.Error.NoReply` in D-Bus terms, which is the type of the first of the two issues above). And finally it separates the `ErrorType.SERVICE_UNKNOWN` (or `org.freedesktop.DBus.Error.ServiceUnknown` in D-Bus terms, which is the second of the above issue) from `DBusInterfaceError` into a new `DBusServiceUnkownError`. This allows to handle errors more specifically. To avoid too much churn, all instances where `DBusInterfaceError` got handled, we are now also handling `DBusServiceUnkownError`. The `DBusNoReplyError` and `DBusServiceUnkownError` appear when the NetworkManager service stops or crashes. Instead of retrying every interface we know, just give up if one of these issues appear. This should significantly lower error messages users are seeing and Sentry events. * Remove unnecessary statement * Fix pytests * Make sure error strings are compared correctly * Fix typo/remove unnecessary pylint exception * Fix DBusError typing * Add pytest for from_dbus_error * Revert "Make sure error strings are compared correctly" This reverts commit 10dc2e4. * Add test cases --------- Co-authored-by: Mike Degatano <[email protected]>
- Loading branch information
Showing
23 changed files
with
232 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.