Skip to content

Commit

Permalink
nmclient: Explicitly create a new client object only in netinfo
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
EdDev committed Feb 26, 2019
1 parent 1dff6c5 commit a08f7dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libnmstate/netinfo.py
Expand Up @@ -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()]

Expand Down
2 changes: 1 addition & 1 deletion libnmstate/nm/device.py
Expand Up @@ -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()


Expand Down

0 comments on commit a08f7dc

Please sign in to comment.