From 2bde8d906bee9f4f1ede5e7c6a62112f900c9504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 15 May 2014 18:34:57 +0200 Subject: [PATCH] dispvm: do not fail when notification service unavailable --- dispvm/qfile-daemon-dvm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dispvm/qfile-daemon-dvm b/dispvm/qfile-daemon-dvm index 47587c7d..3fdd38ed 100755 --- a/dispvm/qfile-daemon-dvm +++ b/dispvm/qfile-daemon-dvm @@ -132,10 +132,12 @@ class QfileDaemonDvm: return True def tray_notify(self, str, timeout = 3000): - notify_object.Notify("Qubes", 0, "red", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications") + 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): - notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications") + if notify_object: + notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications") def get_dvm(self): if not self.dvm_setup_ok(): @@ -166,7 +168,11 @@ def main(): # sys.argv[5] - override firewall print >>sys.stderr, "time=%s, qfile-daemon-dvm init" % (str(time.time())) - notify_object = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications") + 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')