connect: Fix handling of missing avahi (bz 1213299)

gdbus seems to behave differently here now. Perform an API check at
initial lookup time to ensure avahi is available
This commit is contained in:
Cole Robinson 2015-04-20 12:32:33 -04:00
parent 7b1a4634a8
commit 8aefc012c5
1 changed files with 6 additions and 2 deletions

View File

@ -89,14 +89,18 @@ class vmmConnect(vmmGObjectUI):
self.set_initial_state()
self.dbus = None
self.avahiserver = None
try:
self.dbus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
self.avahiserver = Gio.DBusProxy.new_sync(self.dbus, 0, None,
"org.freedesktop.Avahi", "/",
"org.freedesktop.Avahi.Server", None)
# Call any API, so we detect if avahi is even available or not
self.avahiserver.GetAPIVersion()
logging.debug("Connected to avahi")
except Exception, e:
self.dbus = None
self.avahiserver = None
logging.debug("Couldn't contact avahi: %s", str(e))
self.reset_state()