From: Martin Schwenke Date: Wed, 12 Jul 2023 00:39:06 +0000 (+1000) Subject: ctdb-tools: Always print script output in event status X-Git-Tag: ldb-2.8.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3c0b72c340f86b1d6e4fd009d1082c7e477fd04;p=thirdparty%2Fsamba.git ctdb-tools: Always print script output in event status When event scripts succeed they generally produce no output. However, when a script succeeds and produces output, such output almost certainly contains warnings. So, always print script output. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/event/event_tool.c b/ctdb/event/event_tool.c index 46dc25e6c30..5e94af1d9bc 100644 --- a/ctdb/event/event_tool.c +++ b/ctdb/event/event_tool.c @@ -197,7 +197,8 @@ static void print_status_one(struct ctdb_event_script *script) ctime(&script->begin.tv_sec)); } - if (script->result != 0 && script->result != -ENOEXEC) { + if ((script->result != 0 && script->result != -ENOEXEC) || + script->output != NULL) { printf(" OUTPUT: %s\n", script->output == NULL ? "" : script->output); } diff --git a/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/02.enabled.script b/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/02.enabled.script index f25e7242543..a59c58bf692 100755 --- a/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/02.enabled.script +++ b/ctdb/tests/UNIT/eventd/etc-ctdb/events/random/02.enabled.script @@ -5,7 +5,27 @@ case "$1" in "failure") exit 1 ;; "timeout") sleep 99 ;; "verbose") echo "Running event $1" ; exit 0 ;; +"verbosemultiline") + cat <