Skip to content

Commit d61df07

Browse files
commands: add retries to ctdb-must-have-nodes command
Signed-off-by: John Mulligan <[email protected]>
1 parent dc564c8 commit d61df07

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

sambacc/commands/ctdb.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,16 @@ def ctdb_must_have_node(ctx: Context) -> None:
412412
expected_pnn = np.node_number or 0
413413
waiter = np.cluster_meta_waiter()
414414

415+
limiter = ErrorLimiter("ctdb_must_have_node", 10, pause_func=waiter.wait)
415416
while True:
416-
if ctdb.pnn_in_cluster_meta(
417-
cmeta=np.cluster_meta(),
418-
pnn=expected_pnn,
419-
):
420-
break
421-
_logger.info("node not yet ready")
422-
waiter.wait()
417+
with limiter.catch():
418+
if ctdb.pnn_in_cluster_meta(
419+
cmeta=np.cluster_meta(),
420+
pnn=expected_pnn,
421+
):
422+
break
423+
_logger.info("node not yet ready")
424+
waiter.wait()
423425
if ctx.cli.write_nodes:
424426
_logger.info("Writing nodes file")
425427
ctdb.cluster_meta_to_nodes(np.cluster_meta(), dest=np.persistent_path)

0 commit comments

Comments
 (0)