[Kimchi-devel] [PATCH] Bug fix #357 - Error when creating template from ISO

Ramon Medeiros ramonn at linux.vnet.ibm.com
Fri Apr 11 13:15:41 UTC 2014


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 at 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




More information about the Kimchi-devel mailing list