]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Put output under the control of failure counting
authorMartin Schwenke <mschwenke@ddn.com>
Sun, 1 Mar 2026 04:18:00 +0000 (15:18 +1100)
committerAmitay Isaacs <amitay@samba.org>
Thu, 9 Jul 2026 16:02:43 +0000 (16:02 +0000)
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 <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/events/legacy/40.vsftpd.script
ctdb/tests/UNIT/eventscripts/40.vsftpd.monitor.002.sh

index 89119d4d06541225d751270d294789cd56103d2b..7bc607e50b8db33269f184552a509038ef80dba0 100755 (executable)
@@ -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
index f825be4d02a1d0d943c80248926fb4f1c461a2f8..abdb3e7f255439e6c1d8e6d2ff3c4c504b457009 100755 (executable)
@@ -12,8 +12,8 @@ simple_test
 setup "down"
 
 ok <<EOF
-vsftpd not listening on TCP port 21
 WARNING: vsftpd listening on TCP port 21: fail count 1 >= threshold 1
+vsftpd not listening on TCP port 21
 EOF
 simple_test
 
@@ -27,19 +27,44 @@ simple_test
 setup "down"
 
 ok <<EOF
-vsftpd not listening on TCP port 21
 WARNING: vsftpd listening on TCP port 21: fail count 1 >= threshold 1
+vsftpd not listening on TCP port 21
 EOF
 simple_test
 
 required_result 1 <<EOF
-vsftpd not listening on TCP port 21
 ERROR: vsftpd listening on TCP port 21: fail count 2 >= threshold 2
+vsftpd not listening on TCP port 21
 EOF
 simple_test
 
 required_result 1 <<EOF
+ERROR: vsftpd listening on TCP port 21: fail count 3 >= threshold 2
+EOF
+simple_test
+
+setup "up"
+
+ok <<EOF
+NOTICE: vsftpd listening on TCP port 21: no longer failing
+EOF
+simple_test
+
+setup "down"
+
+ok <<EOF
+WARNING: vsftpd listening on TCP port 21: fail count 1 >= threshold 1
 vsftpd not listening on TCP port 21
+EOF
+simple_test
+
+required_result 1 <<EOF
+ERROR: vsftpd listening on TCP port 21: fail count 2 >= threshold 2
+vsftpd not listening on TCP port 21
+EOF
+simple_test
+
+required_result 1 <<EOF
 ERROR: vsftpd listening on TCP port 21: fail count 3 >= threshold 2
 EOF
 simple_test