Merge pull request #88 from mattrose/dbus-error
Do not crash when dbus server is unavailable, just emit an error message
This commit is contained in:
commit
3f20a8ac27
|
@ -11,7 +11,7 @@ from .borg import Borg
|
||||||
from .terminator import Terminator
|
from .terminator import Terminator
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .factory import Factory
|
from .factory import Factory
|
||||||
from .util import dbg, enumerate_descendants
|
from .util import dbg, err, enumerate_descendants
|
||||||
|
|
||||||
CONFIG = Config()
|
CONFIG = Config()
|
||||||
if not CONFIG['dbus']:
|
if not CONFIG['dbus']:
|
||||||
|
@ -46,7 +46,11 @@ class DBusService(Borg, dbus.service.Object):
|
||||||
"""Ensure we are populated"""
|
"""Ensure we are populated"""
|
||||||
if not self.bus_name:
|
if not self.bus_name:
|
||||||
dbg('Checking for bus name availability: %s' % BUS_NAME)
|
dbg('Checking for bus name availability: %s' % BUS_NAME)
|
||||||
|
try:
|
||||||
bus = dbus.SessionBus()
|
bus = dbus.SessionBus()
|
||||||
|
except Exception as e:
|
||||||
|
err('Unable to connect to DBUS Server, proceeding as standalone')
|
||||||
|
raise ImportError
|
||||||
proxy = bus.get_object('org.freedesktop.DBus',
|
proxy = bus.get_object('org.freedesktop.DBus',
|
||||||
'/org/freedesktop/DBus')
|
'/org/freedesktop/DBus')
|
||||||
flags = 1 | 4 # allow replacement | do not queue
|
flags = 1 | 4 # allow replacement | do not queue
|
||||||
|
|
Loading…
Reference in New Issue