From c924cbb7c6d2b8d9018c92bee75deed101516b64 Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Tue, 23 Jul 2024 17:33:31 +0200 Subject: [PATCH] chore: check if broker is running before starting In case the identity broker is not registered as systemd service, we cannot start it. This however is also not needed, as long as the service is visible on the bus. This patch changes the logic to check for a running broker by first checking if it is running and only if not starting it. Signed-off-by: Felix Moessbauer --- linux-entra-sso.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-entra-sso.py b/linux-entra-sso.py index 2421516..6c6e02b 100755 --- a/linux-entra-sso.py +++ b/linux-entra-sso.py @@ -82,7 +82,8 @@ def __init__(self, daemon=False): def _check_broker_online(self): dbus = self._bus.get('org.freedesktop.DBus', '/org/freedesktop/DBus') - if dbus.StartServiceByName(self.BROKER_NAME, 0) in \ + if dbus.NameHasOwner(self.BROKER_NAME) \ + or dbus.StartServiceByName(self.BROKER_NAME, 0) in \ [START_REPLY_ALREADY_RUNNING, START_REPLY_SUCCESS]: self._instantiate_broker() self.broker_online = True