After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744700 - [RFE] add ReadConnection DBus method to read connection from settings plugins and returning it to the user (for inspection)
[RFE] add ReadConnection DBus method to read connection from settings plugins...
Status: RESOLVED OBSOLETE
Product: NetworkManager
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on: 744699 744702
Blocks: nm-next
 
 
Reported: 2015-02-18 10:47 UTC by Thomas Haller
Modified: 2020-11-12 14:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Thomas Haller 2015-02-18 10:47:11 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.
Comment 1 Thomas Haller 2015-08-18 16:21:52 UTC
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.
Comment 2 André Klapper 2020-11-12 14:26:56 UTC
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).