Fix psutil 'connections' deprecation warning

When running the functional tests, calls to
psutil.Process.connections() in class OvsdbServer.start()
generates this:

  DeprecationWarning: connections() is deprecated and
  will be removed; use net_connections() instead

Since we are already requiring psutil>=6.1.0 and
net_connections() was introduced in 6.0.0, just update
the call.

TrivialFix

Change-Id: If5f7dc74dc65aeb40b51a67f0fbe2b33f6ca3e7c
This commit is contained in:
Brian Haley 2024-12-18 20:10:29 -05:00
parent 559672f777
commit 38ab07ed51

View File

@ -218,7 +218,7 @@ class OvsdbServer(DaemonProcessFixture):
reraise=True)
def get_ovsdb_remote_port_retry(pid):
process = psutil.Process(pid)
for connect in process.connections():
for connect in process.net_connections():
if connect.status == 'LISTEN':
return connect.laddr[1]
raise Exception(_("Could not find LISTEN port."))