Skip to content

Commit

Permalink
commands: add retries to ctdb-must-have-nodes command
Browse files Browse the repository at this point in the history
Signed-off-by: John Mulligan <jmulligan@redhat.com>
  • Loading branch information
phlogistonjohn committed Sep 4, 2024
1 parent dc564c8 commit d61df07
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions sambacc/commands/ctdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,16 @@ def ctdb_must_have_node(ctx: Context) -> None:
expected_pnn = np.node_number or 0
waiter = np.cluster_meta_waiter()

limiter = ErrorLimiter("ctdb_must_have_node", 10, pause_func=waiter.wait)
while True:
if ctdb.pnn_in_cluster_meta(
cmeta=np.cluster_meta(),
pnn=expected_pnn,
):
break
_logger.info("node not yet ready")
waiter.wait()
with limiter.catch():
if ctdb.pnn_in_cluster_meta(
cmeta=np.cluster_meta(),
pnn=expected_pnn,
):
break
_logger.info("node not yet ready")
waiter.wait()
if ctx.cli.write_nodes:
_logger.info("Writing nodes file")
ctdb.cluster_meta_to_nodes(np.cluster_meta(), dest=np.persistent_path)
Expand Down

0 comments on commit d61df07

Please sign in to comment.