From: Martin Schwenke Date: Sun, 1 Mar 2026 04:18:00 +0000 (+1100) Subject: ctdb-scripts: Put output under the control of failure counting X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d244ba7c0d40875566e43f5969683da82cd2ddf;p=thirdparty%2Fsamba.git ctdb-scripts: Put output under the control of failure counting The port checking output should be under the control of the failure counting. It shouldn't be printed every time. Duplicate most of the associated test to ensure that the counter is correctly reset. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/events/legacy/40.vsftpd.script b/ctdb/config/events/legacy/40.vsftpd.script index 89119d4d065..7bc607e50b8 100755 --- a/ctdb/config/events/legacy/40.vsftpd.script +++ b/ctdb/config/events/legacy/40.vsftpd.script @@ -43,13 +43,14 @@ ipreallocated) ;; monitor) - if ctdb_check_tcp_ports 21; then + if output=$(ctdb_check_tcp_ports 21); then failcount_reset "$port_21" else # Set defaults, if unset : "${CTDB_VSFTPD_MONITOR_THRESHOLDS:=1:2}" - failcount_incr "$port_21" "$CTDB_VSFTPD_MONITOR_THRESHOLDS" + failcount_incr \ + "$port_21" "$CTDB_VSFTPD_MONITOR_THRESHOLDS" "$output" fi ;; esac diff --git a/ctdb/tests/UNIT/eventscripts/40.vsftpd.monitor.002.sh b/ctdb/tests/UNIT/eventscripts/40.vsftpd.monitor.002.sh index f825be4d02a..abdb3e7f255 100755 --- a/ctdb/tests/UNIT/eventscripts/40.vsftpd.monitor.002.sh +++ b/ctdb/tests/UNIT/eventscripts/40.vsftpd.monitor.002.sh @@ -12,8 +12,8 @@ simple_test setup "down" ok <= threshold 1 +vsftpd not listening on TCP port 21 EOF simple_test @@ -27,19 +27,44 @@ simple_test setup "down" ok <= threshold 1 +vsftpd not listening on TCP port 21 EOF simple_test required_result 1 <= threshold 2 +vsftpd not listening on TCP port 21 EOF simple_test required_result 1 <= threshold 2 +EOF +simple_test + +setup "up" + +ok <= threshold 1 vsftpd not listening on TCP port 21 +EOF +simple_test + +required_result 1 <= threshold 2 +vsftpd not listening on TCP port 21 +EOF +simple_test + +required_result 1 <= threshold 2 EOF simple_test