Skip to content

Commit

Permalink
chore: check if broker is running before starting
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
fmoessbauer committed Jul 24, 2024
1 parent 2213ec2 commit c924cbb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion linux-entra-sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c924cbb

Please sign in to comment.