Catch errors when connection to dbus
This commit is contained in:
parent
f2405a6aba
commit
afecfd9163
|
@ -84,14 +84,15 @@ class vmmConnect(gobject.GObject):
|
|||
|
||||
self.window.get_widget("conn-list").get_selection().connect("changed", self.conn_selected)
|
||||
|
||||
self.bus = dbus.SystemBus()
|
||||
self.bus = None
|
||||
self.server = None
|
||||
self.can_browse = False
|
||||
try:
|
||||
self.bus = dbus.SystemBus()
|
||||
self.server = dbus.Interface(self.bus.get_object("org.freedesktop.Avahi", "/"), "org.freedesktop.Avahi.Server")
|
||||
self.can_browse = True
|
||||
except Exception, e:
|
||||
logging.debug("Couldn't contact avahi: %s" % str(e))
|
||||
self.server = None
|
||||
self.can_browse = False
|
||||
|
||||
self.reset_state()
|
||||
|
||||
|
|
|
@ -773,9 +773,9 @@ class vmmConnection(gobject.GObject):
|
|||
logging.debug("Skipping policykit check as root")
|
||||
return 0
|
||||
logging.debug("Doing policykit for %s" % action)
|
||||
bus = dbus.SessionBus()
|
||||
|
||||
try:
|
||||
bus = dbus.SessionBus()
|
||||
# First try to use org.freedesktop.PolicyKit.AuthenticationAgent
|
||||
# which is introduced with PolicyKit-0.7
|
||||
obj = bus.get_object("org.freedesktop.PolicyKit.AuthenticationAgent", "/")
|
||||
|
|
Loading…
Reference in New Issue