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>
{
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);
}
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);
}
}