nmcli: warn if daemon version mismatch

When updating NetworkManager to a new version, normally the service is
not restarted by the installer to avoid interrupting networking.
However, next nmcli invocation will use the updated version, but against
the older version of the daemon that is still running. Although this is
suposed to work, it is advisable that nmcli and daemon's versions are
the same. Emit a warning recommending restarting the daemon.

Add nmcli test to check the new feature. To avoid breaking the existing
tests, test-networkmanager-service now reports the same version than the
running nmcli except if it's instructed to report a different one.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1703
This commit is contained in:
Íñigo Huguet
2023-07-27 12:35:15 +02:00
committed by Fernando Fernandez Mancera
parent 1dff015627
commit fb851f3294
7 changed files with 81 additions and 5 deletions

View File

@@ -1589,7 +1589,9 @@ class NetworkManager(ExportedObj):
PRP_NM_ACTIVATING_CONNECTION: ExportedObj.to_path(None),
PRP_NM_STARTUP: False,
PRP_NM_STATE: dbus.UInt32(NM.State.DISCONNECTED),
PRP_NM_VERSION: "0.9.9.0",
PRP_NM_VERSION: os.environ.get(
"NM_TEST_NETWORKMANAGER_SERVICE_VERSION", "0.9.9.0"
),
PRP_NM_CONNECTIVITY: dbus.UInt32(NM.ConnectivityState.NONE),
}