Skip to content

[th/libnm-undeprecate-get-secrets] libnm: undeprecate nm_remote_connection_get_secrets()

Thomas Haller requested to merge th/libnm-undeprecate-get-secrets into main

Various synchronous methods (D-Bus calls) in libnm's NMClient API were deprecated. The problem is that NMClient contains a cache of D-Bus objects, and it gets updated by asynchronous events (D-Bus signals). Those events get only processed when iterating the GMainContext, but they are ordered.

When we perform a pseudo blocking D-Bus call with g_dbus_connection_call_sync(), then GDBus creates a temporary GMainContext, sends the request and iterates the internal context blocking for the response. That is, this reply is not synchrounized with the events that update the NMClient cache.

That is a problem for methods like nm_remote_connection_delete(), because you call blocking delete, but afterwards the object is still in the NMClient cache. That's why most blocking methods are deprecated.

While such blocking calls are therefore problematic, they can still be very convenient to call from a simple script, a test tool or the python REPL. See "examples/python/gi/nm-wg-set" which calls nm_remote_connection_get_secrets(), and it would be (unnecessarily) cumbersome to do the correct thing or using async API.

In particular, nm_remote_connection_get_secrets() doesn't retrieve an object that is in the NMClient cache in the first place. Sure, the result is out of order with the cache, but it's not obviously related and in most cases it wouldn't matter to the user. So undeprecate this function again.

Merge request reports