[virt-tools-list] [PATCH 1/3] avoid referencing ConnectError if it is None

Daniel P. Berrangé berrange at redhat.com
Wed Apr 4 13:35:40 UTC 2018


Currently it throws an exception at startup which is hidden unless you
run with --no-fork

  $ python3 ./virt-manager --no-fork
  Traceback (most recent call last):
    File "/home/berrange/src/virt/virt-manager/virtManager/baseclass.py", line 225, in wrap_func
      return func(*wrapargs)
    File "/home/berrange/src/virt/virt-manager/virtManager/engine.py", line 206, in conn_open_completed
      ConnectError.details)
  AttributeError: 'NoneType' object has no attribute 'details'

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 virtManager/engine.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/virtManager/engine.py b/virtManager/engine.py
index de1c625c..9ca2d4ea 100644
--- a/virtManager/engine.py
+++ b/virtManager/engine.py
@@ -202,8 +202,9 @@ class vmmEngine(vmmGObject):
         def conn_open_completed(_conn, ConnectError):
             # Explicitly ignore connection errors, we've done that
             # for a while and it can be noisy
-            logging.debug("Autostart connection error: %s",
-                    ConnectError.details)
+            if ConnectError is not None:
+                logging.debug("Autostart connection error: %s",
+                              ConnectError.details)
             add_next_to_queue()
 
         def handle_queue():
-- 
2.14.3




More information about the virt-tools-list mailing list