Skip to content

Commit a123083

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
commands: add --write-node option to ctdb-must-have-node cmd
Add a --write-node option to the ctdb-must-have-node command so that containers without a shared file system can at least join a ctdb cluster. This a bit hacky but it works to test things out. Signed-off-by: John Mulligan <[email protected]>
1 parent c29e7b2 commit a123083

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

sambacc/commands/ctdb.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,18 @@ def ctdb_manage_nodes(ctx: Context) -> None:
328328
waiter.wait()
329329

330330

331-
@commands.command(name="ctdb-must-have-node", arg_func=_ctdb_general_node_args)
331+
def _ctdb_must_have_node_args(parser: argparse.ArgumentParser) -> None:
332+
_ctdb_general_node_args(parser)
333+
parser.add_argument(
334+
"--write-nodes",
335+
action="store_true",
336+
help="Specify node by IP",
337+
)
338+
339+
340+
@commands.command(
341+
name="ctdb-must-have-node", arg_func=_ctdb_must_have_node_args
342+
)
332343
def ctdb_must_have_node(ctx: Context) -> None:
333344
"""Block until the current node is present in the ctdb nodes file."""
334345
_ctdb_ok()
@@ -341,6 +352,11 @@ def ctdb_must_have_node(ctx: Context) -> None:
341352
cmeta=np.cluster_meta(),
342353
pnn=expected_pnn,
343354
):
344-
return
355+
break
345356
_logger.info("node not yet ready")
346357
waiter.wait()
358+
if ctx.cli.write_nodes:
359+
_logger.info("Writing nodes file")
360+
ctdb.cluster_meta_to_nodes(
361+
np.cluster_meta(), real_path=np.persistent_path
362+
)

0 commit comments

Comments
 (0)