]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-common: Make run_event return full script list
authorMartin Schwenke <mschwenke@ddn.com>
Mon, 29 Sep 2025 05:24:10 +0000 (15:24 +1000)
committerRalph Boehme <slow@samba.org>
Tue, 7 Oct 2025 10:08:34 +0000 (10:08 +0000)
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 <mschwenke@ddn.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
ctdb/common/run_event.c
ctdb/event/event_tool.c

index efcf9942274a5a7ef451047d3d483d3d2b4b0a5e..dee46ad2949fd56d6e3f879ab9b6c658c98847e5 100644 (file)
@@ -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);
index d6b7156c69bf96edf28fa50102156574e7c82182..1acf94f14926ee033ba4d729128a3aea179a37e6 100644 (file)
@@ -281,7 +281,12 @@ static void print_status(const char *component,
        }
 
        for (i=0; i<status->script_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);
        }
 }