def __init__(self, options):
gobject.threads_init()
dbus.mainloop.glib.threads_init()
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
Bus.__init__(self)
busaddr = options.busaddr
self.bus = dbus.SessionBus() if busaddr == DEFAULT_BUS else \
dbus.bus.BusConnection(busaddr)
counter = 20
while not (counter == 0):
try:
self.rebus = self.bus.get_object("com.airbus.rebus.bus",
"/bus")
counter = 0
except dbus.exceptions.DBusException as e:
log.warning("Cannot get bus object's because : " + str(e) +
" : wait 5s and retry")
counter = counter - 1
time.sleep(5)
signal.signal(signal.SIGTERM, self.sigterm_handler)
#: Contains agent instance. This Bus implementation accepts only one
#: agent. Agent must be run using separate DBus() (bus slave)
#: instances.
self.agent = None
self.loop = None
self.main_thread_id = thread.get_ident()
评论列表
文章目录