Use Python dbus-next D-Bus library#3234
Conversation
There was a problem hiding this comment.
We need to make sure that the error handling is 100% good, otherwise, we can run into boot loops. I already tried to replace the gdbus with a different library as you now use, but I was forced to stop my work on the branch because of a bad design with error handling on that library. This looks better, we need just make sure it works stable on a system with issues. We have also to cleanup the docker file and not install gdbus, and make sure we don't check this on bootstrap
I think it was #1248 which actually added dbus-next, this library. But dbus-next evolved quite a bit since then, from the changelog it seems that also error handling got improved since then. Thanks for the input, I'll test with that in mind. |
|
|
I named it after the implementation just like before, so |
Yeah, I think the generic is better as we use it as middle layer |
d17a4b6 to
4c5ba9d
Compare
|
You need rebase it for CI |
It seems that gdbus (or systemd) automatically pick the correct interface and return the properties. However, dbussy requires the correct interface name to get all properties.
The property returns a type "y" which equates to "guchar": https://developer-old.gnome.org/NetworkManager/stable/gdbus-org.freedesktop.NetworkManager.AccessPoint.html#gdbus-property-org-freedesktop-NetworkManager-AccessPoint.Strength It seems that the old D-Bus implementation returned an array. With dbussy a integer is returned, so no list indexing required.
That is what the interface is expecting, otherwise the new lib choks on the Pathlib type.
Assemble Python native objects and pass them to dbus-next. Use dbus-next specific Variant class where necessary.
org.freedesktop.NetworkManager.Connection.Active.PropertyChanged is depricated. Also it seems that StateChanged leads to fewer and more accurate signals.
RequestScan expects an option dictionary. Pass an empty option dictionary to it.
Replace gdbus specific fixtures with json files representing the return values. Those can be easily converted into native Python objects.
The key name where the auth algorithm is stored is "auth-alg" instead of "auth-algo".
5bb715b to
3f3b48d
Compare
Proposed change
Use dbus-next library to communicate with D-Bus. dbus-next is a pure Python 3 library, supporting the asyncio main loop.
Tested & working:
Type of change
Additional information
Checklist
black --fast supervisor tests)If API endpoints of add-on configuration are added/changed: