Skip to content

Commit

Permalink
Don't fail if a service name cannot be looked up in LDAP
Browse files Browse the repository at this point in the history
A new method was introduced to handle more IPA services. This
requires looking some of them up in LDAP. dirsrv not running
was not being caught so raised an error instead.

Fixes: #312

Signed-off-by: Rob Crittenden <[email protected]>
  • Loading branch information
rcritten committed Nov 14, 2023
1 parent a6b89d4 commit 35ff773
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ipahealthcheck/meta/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,18 @@ class IPAServiceCheck(ServiceCheck):
def get_service_name(self, role):
"""Roles define broad services. Translate a role name into
an individual service name.
Returns a string on success, None if the service is not
configured or cannot be determined.
"""
conn = api.Backend.ldap2
if not api.Backend.ldap2.isconnected():
api.Backend.ldap2.connect()
try:
if not api.Backend.ldap2.isconnected():
api.Backend.ldap2.connect()
except errors.NetworkError:
logger.debug("Service '%s' is not running", self.service_name)
return None

dn = DN(
("cn", role), ("cn", api.env.host),
("cn", "masters"), ("cn", "ipa"), ("cn", "etc"),
Expand Down

0 comments on commit 35ff773

Please sign in to comment.