From 12c1b07819052199deadf7d8f5d73f68c6869821 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 24 Aug 2010 14:55:00 -0400 Subject: [PATCH] connection: Clean up connection startup error message - Drop SSH askpass reference: latest libvirt should return SSH connection errors to us, which will make clear that ssh-askpass isn't available. - Print error message up front, traceback afterwards, and clearly separate. --- src/virtManager/connection.py | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/src/virtManager/connection.py b/src/virtManager/connection.py index 9a15db3a6..ec43b40c5 100644 --- a/src/virtManager/connection.py +++ b/src/virtManager/connection.py @@ -999,32 +999,22 @@ class vmmConnection(gobject.GObject): if not open_error: self.state = self.STATE_ACTIVE - else: - self.state = self.STATE_DISCONNECTED + continue - if self.uri.find("+ssh://") > 0: - hint = "\nMaybe you need to install ssh-askpass " + \ - "in order to authenticate." - else: - hint = "" + self.state = self.STATE_DISCONNECTED + (_type, value, stacktrace) = open_error - (_type, value, stacktrace) = open_error + if (_type == libvirt.libvirtError and + value.get_error_code() == libvirt.VIR_ERR_AUTH_FAILED and + "GSSAPI Error" in value.get_error_message() and + "No credentials cache found" in value.get_error_message()): + if self._acquire_tgt(): + done = False + continue - if (type(_type) == libvirt.libvirtError and - value.get_error_code() == libvirt.VIR_ERR_AUTH_FAILED and - "GSSAPI Error" in value.get_error_message() and - "No credentials cache found" in value.get_error_message()): - if self._acquire_tgt(): - done = False - continue + tb = "".join(traceback.format_exception(_type, value, stacktrace)) - tb = "".join(traceback.format_exception(_type, value, - stacktrace)) - - # Detailed error message, in English so it can be Googled. - self.connectError = (("Unable to open connection to hypervisor" - " URI '%s':\n%s\n%s" - % (str(self.uri), value, tb + hint))) + self.connectError = "%s\n\n%s" % (str(value), str(tb)) # We want to kill off this thread asap, so schedule a gobject # idle even to inform the UI of result