mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 07:33:27 -06:00
Make wait_for_entry raise exceptions
Instead of only logging errors when timeout is reached or query for the entry fails for other reasons, `wait_for_entry` should raise exceptions so that we can handle them in caller or let them propagate and fail early. https://pagure.io/freeipa/issue/6739 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
bd18b5f91e
commit
069948466e
@ -177,7 +177,7 @@ def wait_for_entry(connection, dn, timeout=7200, attr='', quiet=True):
|
||||
pass # no entry yet
|
||||
except Exception as e: # badness
|
||||
root_logger.error("Error reading entry %s: %s", dn, e)
|
||||
break
|
||||
raise
|
||||
if not entry:
|
||||
if not quiet:
|
||||
sys.stdout.write(".")
|
||||
@ -185,13 +185,10 @@ def wait_for_entry(connection, dn, timeout=7200, attr='', quiet=True):
|
||||
time.sleep(1)
|
||||
|
||||
if not entry and int(time.time()) > timeout:
|
||||
root_logger.error(
|
||||
"wait_for_entry timeout for %s for %s", connection, dn)
|
||||
raise errors.NotFound(
|
||||
reason="wait_for_entry timeout for %s for %s" % (connection, dn))
|
||||
elif entry and not quiet:
|
||||
root_logger.error("The waited for entry is: %s", entry)
|
||||
elif not entry:
|
||||
root_logger.error(
|
||||
"Error: could not read entry %s from %s", dn, connection)
|
||||
|
||||
|
||||
class ReplicationManager(object):
|
||||
|
Loading…
Reference in New Issue
Block a user