nmclient: Explicitly create a new client object only in netinfo

Usage of the NM client object should be limited in most cases to a
single instance.
In particular, during a mainloop run, only a single instance of the
client should be used due to its cached data.

This change is limited in scope, fixing issues seen with current
integration tests. A follow up change will organize the client object
lifetime in a more systematic manner.

Signed-off-by: Edward Haas <edwardh@redhat.com>
This commit is contained in:
Edward Haas 2019-02-26 11:35:17 +02:00
parent 1dff6c5442
commit a08f7dcccb
2 changed files with 3 additions and 1 deletions

View File

@ -52,6 +52,8 @@ def capabilities():
def interfaces():
info = []
nm.nmclient.client(refresh=True)
devices_info = [(dev, nm.device.get_device_common_info(dev))
for dev in nm.device.list_devices()]

View File

@ -342,7 +342,7 @@ def get_device_by_name(devname):
def list_devices():
client = nmclient.client(refresh=True)
client = nmclient.client()
return client.get_devices()