From: Martin Schwenke Date: Mon, 29 Sep 2025 05:24:10 +0000 (+1000) Subject: ctdb-common: Make run_event return full script list X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a05a2be09d71f49e06299dc79d36f5aa8dd8c212;p=thirdparty%2Fsamba.git ctdb-common: Make run_event return full script list run_event currently truncates the resulting script list after the first failure. Instead, return the full script list, with scripts that weren't run flagged with ENODATA in their summary. This structure is zeroed on allocation, so this is the only field that needs to be set. For now, have the event tool skip such scripts. Do this in print_status() instead of print_status_one(), since there will soon be additional checks in print_status() and it makes sense to put them together. Signed-off-by: Martin Schwenke Reviewed-by: Ralph Boehme --- diff --git a/ctdb/common/run_event.c b/ctdb/common/run_event.c index efcf9942274..dee46ad2949 100644 --- a/ctdb/common/run_event.c +++ b/ctdb/common/run_event.c @@ -795,8 +795,13 @@ static void run_event_fail(struct tevent_req *req, { struct run_event_state *state = tevent_req_data( req, struct run_event_state); + struct run_event_script_list *script_list = state->script_list; + unsigned int i; - state->script_list->num_scripts = state->index + 1; + /* Mark remaining scripts as having no data */ + for (i = state->index + 1; i < script_list->num_scripts; i++) { + script_list->script[i].summary = -ENODATA; + } if (script->summary == -ETIMEDOUT && pid != -1) { run_event_debug(req, pid); diff --git a/ctdb/event/event_tool.c b/ctdb/event/event_tool.c index d6b7156c69b..1acf94f1492 100644 --- a/ctdb/event/event_tool.c +++ b/ctdb/event/event_tool.c @@ -281,7 +281,12 @@ static void print_status(const char *component, } for (i=0; iscript_list->num_scripts; i++) { - print_status_one(&status->script_list->script[i]); + struct ctdb_event_script *s = &status->script_list->script[i]; + + if (s->result == -ENODATA) { + continue; + } + print_status_one(s); } }