mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
service: handle empty list of services to update their state
When there are no services in LDAP that have specified states, we don't need to update their state. Fixes: https://pagure.io/freeipa/issue/8623 Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
parent
35362d3033
commit
b7c00f2a1f
@ -252,12 +252,18 @@ def _set_services_state(fqdn, dest_state):
|
|||||||
rules=ldap2.MATCH_ALL
|
rules=ldap2.MATCH_ALL
|
||||||
)
|
)
|
||||||
|
|
||||||
entries = ldap2.get_entries(
|
try:
|
||||||
search_base,
|
entries = ldap2.get_entries(
|
||||||
filter=search_filter,
|
search_base,
|
||||||
scope=api.Backend.ldap2.SCOPE_ONELEVEL,
|
filter=search_filter,
|
||||||
attrs_list=['cn', 'ipaConfigString']
|
scope=api.Backend.ldap2.SCOPE_ONELEVEL,
|
||||||
)
|
attrs_list=['cn', 'ipaConfigString']
|
||||||
|
)
|
||||||
|
except errors.EmptyResult:
|
||||||
|
logger.debug("No services with a state from %s, ignoring",
|
||||||
|
list(source_states))
|
||||||
|
return
|
||||||
|
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
name = entry['cn']
|
name = entry['cn']
|
||||||
cfgstrings = entry.setdefault('ipaConfigString', [])
|
cfgstrings = entry.setdefault('ipaConfigString', [])
|
||||||
|
Loading…
Reference in New Issue
Block a user