Adjust psutil usage for psutil > 2

psutil 2.x and above has a lot of API changes as described in:

https://github.com/giampaolo/psutil/blob/master/HISTORY.rst

Change-Id: I1380f488390c83a44d91b84218f1b1ba826d03a0
Closes-Bug: 1659146
This commit is contained in:
Dirk Mueller
2017-01-25 00:54:26 +01:00
parent 7c771abe0e
commit f8a224a63f

View File

@ -110,7 +110,10 @@ class TestNeutronServer(base.BaseTestCase):
def safe_ppid(proc):
try:
return proc.ppid
if psutil.version_info[0] == 1:
return proc.ppid
else:
return proc.ppid()
except psutil.NoSuchProcess:
return None