When deleting connections after editing, sometimes the connection is not found.
Wait until the connection settles down to avoid connection not found errors
during cleanup. Seems to work for now but still not the best way to handle this.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Also don't require updating all the common properties of a connection when
updating only some properties such as 'autoconnect'.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Network Manager client fetches the basic information from Network Manager,
caches it and updates the cache whenever it receives the signal. So, create only
a single instance of it and reuse it. Reusing from different threads is
apparently fine because the underlying DBusConnection is a singleton[1] that is
meant to be used from multiple threads.
The glib main loop context that is related to the client must run even after the
network manager client object goes away[2]. So, create the network manager
client instance from a thread that continues to run the glib main thread.
This fixes an infrequent crash when accessing network manager page. The problem
was reproducible from very early version of Network Manager and FreedomBox.
However, in more recent versions of NetworkManager 1.20 with recent DBus changes
in FreedomBox, the problem is more prominent. The problem reduces to a simple
warning in NetworkManager 1.22.
Closes: #1724Closes: #382
Tests:
- Reproduce the problem by accessing the networks app index page repeatedly.
- Create a simple test case file to reproduce the problem and ensure that the
fix works there.
- On Network Manager 1.20 repeatedly access the networks app index page and
create/delete/activate/deactivate/show connections.
- On Network Manager 1.22 repeatedly access the networks app index page and
create/delete/activate/deactivate/show connections.
Links:
1) https://developer.gnome.org/gio/unstable/GDBusConnection.html#g-bus-get-sync
2) https://developer.gnome.org/libnm/stable/NMClient.html#nm-client-get-main-context
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This introduces flake8 and fixes a bunch of flake8 errors.
flake8 is run with: ./venv/bin/flake8 plinth
if you're using a python3 venv.
We can eventually further integrate this with gitlab ci.
https://salsa.debian.org/freedombox-team/plinth/issues/58
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
- Very similar to configuration of IPv4 networks.
- Supports 'auto', 'dhcp', 'manual' and 'ignored' modes as supported by
network manager. 'shared' mode is not yet implemented by network
manager.
- Add module level comments.
- Add comments to reflect docstring styling.
- Since most tests can no longer be run directly, remove __main__
invocation uniformly from all the tests.
- Remove unnecessary test settings and let them take default values.
- Add license header to test settings module.
- Fix a minor issue actions test tear down.
- Improve key/value store tests.