mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
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.
This commit is contained in:
parent
946c43930a
commit
12c1b07819
@ -999,32 +999,22 @@ class vmmConnection(gobject.GObject):
|
|||||||
|
|
||||||
if not open_error:
|
if not open_error:
|
||||||
self.state = self.STATE_ACTIVE
|
self.state = self.STATE_ACTIVE
|
||||||
else:
|
continue
|
||||||
self.state = self.STATE_DISCONNECTED
|
|
||||||
|
|
||||||
if self.uri.find("+ssh://") > 0:
|
self.state = self.STATE_DISCONNECTED
|
||||||
hint = "\nMaybe you need to install ssh-askpass " + \
|
(_type, value, stacktrace) = open_error
|
||||||
"in order to authenticate."
|
|
||||||
else:
|
|
||||||
hint = ""
|
|
||||||
|
|
||||||
(_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
|
tb = "".join(traceback.format_exception(_type, value, stacktrace))
|
||||||
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,
|
self.connectError = "%s\n\n%s" % (str(value), str(tb))
|
||||||
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)))
|
|
||||||
|
|
||||||
# We want to kill off this thread asap, so schedule a gobject
|
# We want to kill off this thread asap, so schedule a gobject
|
||||||
# idle even to inform the UI of result
|
# idle even to inform the UI of result
|
||||||
|
Loading…
Reference in New Issue
Block a user