Support psutil > 2.0 changes in kvmusertests. The main change is that a
variable becomes a method. So, a check was added, to use the method on
psutil 2.0 version and high.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
src/kimchi/kvmusertests.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/kvmusertests.py b/src/kimchi/kvmusertests.py
index 1914a94..b378a04 100644
--- a/src/kimchi/kvmusertests.py
+++ b/src/kimchi/kvmusertests.py
@@ -55,7 +55,15 @@ class UserTests(object):
with open('/var/run/libvirt/qemu/%s.pid' % self.vm_name) as f:
pidStr = f.read()
p = psutil.Process(int(pidStr))
- user = p.username
+
+ # bug fix #357
+ # in psutil 2.0 and above versions, username will be a method,
+ # not a string
+ if callable(p.username):
+ user = p.username()
+ else:
+ user = p.username
+
return user
--
1.8.3.1
Show replies by date
Applied. Thanks.
Regards,
Aline Manera