dispvm: do not fail when notification service unavailable

This commit is contained in:
Marek Marczykowski-Górecki 2014-05-15 18:34:57 +02:00
parent 39496bf65a
commit 2bde8d906b

View File

@ -132,9 +132,11 @@ class QfileDaemonDvm:
return True
def tray_notify(self, str, timeout = 3000):
if notify_object:
notify_object.Notify("Qubes", 0, "red", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
def tray_notify_error(self, str, timeout = 3000):
if notify_object:
notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
def get_dvm(self):
@ -166,7 +168,11 @@ def main():
# sys.argv[5] - override firewall
print >>sys.stderr, "time=%s, qfile-daemon-dvm init" % (str(time.time()))
try:
notify_object = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
except dbus.DBusException as e:
print >>sys.stderr, "Warning: notification service not available: %s" % str(e)
notify_object = None
print >>sys.stderr, "time=%s, creating DispVM" % (str(time.time()))
qfile = QfileDaemonDvm(src_vmname)
lockf = open("/var/run/qubes/qfile-daemon-dvm.lock", 'a')