GNOME Bugzilla – Bug 744700
[RFE] add ReadConnection DBus method to read connection from settings plugins and returning it to the user (for inspection)
Last modified: 2020-11-12 14:26:56 UTC
from downstream: https://bugzilla.redhat.com/show_bug.cgi?id=909181 [paraphrasing/quoting:] Flavio Leitner: Network Manager could include a doct sub command or even a tool that does a quick analysis for misconfigurations. It would check if the configuration is stable before actually use it. This bug proposes a change in a way that NM works currently. The idea is to have some way to configure everything but without actually doing it. Something like --dry-run available for other tools. Then, one could ask NM to check if the new configuration makes sense/is sane before applying it on the system to make sure there is no obvious errors when the changes are being applied. For instance, the gateway address is unreachable with the configured IP address, etc... dcbw: One thought here is a new Settings dbus call like LoadConnections() that takes an 'as' of paths of config files and verifies them, returning an "a(ss)" (array of string+string) that would contain the file which had an error, and the error description, or something like that. We'd then have the settings service ask the plugins to read (but not load!) those files and return the GError message if anything was wrong. So, how about a DBus function to read a setting from file and return the settings hash (without actually loading anything)? The client (nmcli) can then verify it or simply present it to the user. Obviously, if the connection is completely borked and doesn't verify, reading will fail too. This should come together, with libnm supporting keyfile (bug 744699). nmcli could then read the connection and dump if for the user in keyfile format. Possibly it could do some basic verification and issue warnings about unusual settings.
An alternative to have a D-Bus method "LoadConnectionDryRun()" would be to have it all accessible from nmcli (without need for server support). We could move ifcfg-rh support to libnm (like we did for keyfile-reading/writing). Then you could say: nmcli connection read --ifcfg-rh /some/path/ifcfg-connection | \ nmcli connection import or if ! nmcli connection read --ifcfg-rh /some/path/ifcfg-connection; then echo "configuration error" fi or $ nmcli connection read --ifcfg-rh /some/path/ifcfg-connection | \ nmcli connection verify --warn # print some warnings that are common configurations, but not errors Advantage: - works entirely inside libnm, no need for server support. - you can load basically ~any~ file, not only /etc/sysconfig/network-scripts/*. - it builds on having keyfile as import/export format and nmcli writing/reading them from stdin and doing stuff. Neat to have single building blocks that operate on connection and that can you pipe togehter. - it is even independent from nmcli. E.g. you can leverage the loading code from python via libnm-introspection.
bugzilla.gnome.org is being shut down in favor of a GitLab instance. We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time. If you still use NetworkManager and if you still see this bug / want this feature in a recent and supported version of NetworkManager, then please feel free to report it at https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ Thank you for creating this report and we are sorry it could not be implemented (workforce and time is unfortunately limited).