File virtman-git-connection-pylint.diff of Package virt-manager

Subject: connection: Fix some code that trips up pylint
From: Cole Robinson crobinso@redhat.com Tue Aug 30 14:50:29 2011 -0400
Date: Tue Aug 30 14:50:29 2011 -0400:
Git: 66f879e19dfadcb3dcb5a8caeea7ebfa19c40eae


Index: virt-manager-0.9.0/src/virtManager/connection.py
===================================================================
--- virt-manager-0.9.0.orig/src/virtManager/connection.py
+++ virt-manager-0.9.0/src/virtManager/connection.py
@@ -1140,23 +1140,29 @@ class vmmConnection(vmmGObject):
         logging.debug("Background 'open connection' thread is running")
 
         while True:
+            libexc = None
             exc = None
             tb = None
             try:
                 self.vmm = self._try_open()
+            except libvirt.libvirtError, libexc:
+                tb = "".join(traceback.format_exc())
             except Exception, exc:
                 tb = "".join(traceback.format_exc())
 
+            if libexc:
+                exc = libexc
+
             if not exc:
                 self.state = self.STATE_ACTIVE
                 break
 
             self.state = self.STATE_DISCONNECTED
 
-            if (type(exc) == libvirt.libvirtError and
-                exc.get_error_code() == libvirt.VIR_ERR_AUTH_FAILED and
-                "GSSAPI Error" in exc.get_error_message() and
-                "No credentials cache found" in exc.get_error_message()):
+            if (libexc and
+                libexc.get_error_code() == libvirt.VIR_ERR_AUTH_FAILED and
+                "GSSAPI Error" in libexc.get_error_message() and
+                "No credentials cache found" in libexc.get_error_message()):
                 if self._acquire_tgt():
                     continue
 
openSUSE Build Service is sponsored by