commit 2ae3e68f2312d7a595f76d48fe6564efac3d34d2 from: xs date: Sat Jun 7 14:09:52 2025 UTC Prefix values can now be full functions names to be able to trigger just one fonction remotely commit - e50b258b2139fb167ab02e86c5c6c9109008e4ee commit + 2ae3e68f2312d7a595f76d48fe6564efac3d34d2 blob - 46fec8e3bffcfd40c9e2eb82d60817c13ff239d4 blob + 49df62ba5478f1493bfdc4cc476e6f55e404812c --- Makefile +++ Makefile @@ -16,7 +16,7 @@ .POSIX: PREFIX:=/usr/local SHELLS=ksh93 ksh yash sh -UTILITY_VERSION=0.1.5 +UTILITY_VERSION=0.1.6 UTILITY=$(PWD)/r7 # To use the test suite, please edit or use environment for SSH parameters # SSH_ID=/path/to/.ssh/id_ed25519 @@ -73,7 +73,7 @@ install: # Test suite for r7 R=${SHELL} ${UTILITY} test_arguments: usage version debug -test_workdirs: \ +test_workdirs: workdir3-init \ workdir0-arguments \ workdir0-digraph \ workdir1-init \ @@ -114,17 +114,23 @@ poly: usage: @echo _________________________________________________________ + @echo USAGE + @echo _________________________________________________________ $R -h $R -h 2>&1 | grep -q -e usage: -e '\[' @echo _________________________________________________________ version: @echo _________________________________________________________ + @echo VERSION + @echo _________________________________________________________ $R -h 2>&1 | grep -q -e "$(UTILITY_VERSION)" @echo _________________________________________________________ debug: @echo _________________________________________________________ + @echo DEBUG + @echo _________________________________________________________ $R -dn 2>&1 run-config | grep -q "R7 DEBUG $(UTILITY_VERSION)" @echo _________________________________________________________ @@ -274,3 +280,20 @@ workdir2-importer: workdir2-init find testdir/workdir2/nodes | grep sshd_config find testdir/workdir2/nodes @echo _________________________________________________________ + +workdir3-init: + @echo _________________________________________________________ + @echo WORKDIR3-INIT + @echo _________________________________________________________ + rm -fr testdir/workdir3 + $R -dw testdir/workdir3 init + test -d testdir/workdir3 + cd testdir/workdir3 && $R | wc -c | grep -q 0 + cd testdir/workdir3 && \ + cp "$(SSH_ID)" .ssh/id_ed25519_r7 && \ + cp "$(SSH_ID).pub" .ssh/id_ed25519_r7.pub && \ + . $(UTILITY) && for node in $(SSH_TEST_NODES); do \ + mkdir "nodes/$$node" && \ + ssh_accept_new "$$node"; \ + done; + @echo _________________________________________________________ blob - 8a48e540b4022b93b4c036724efb087653780caf blob + 8fbd460c6c691e108cb46deb34bcc4a41ecb9e7c --- r7 +++ r7 @@ -20,7 +20,7 @@ # Global configuration # ==================== -VERSION=0.1.5 +VERSION=0.1.6 : "${HOSTNAME:=$(uname -n)}" # shellcheck disable=SC2031 @@ -557,7 +557,7 @@ group_functions() ( return 0 fi for pre in $prefix; do - grep 2>/dev/null -e "^${pre}_.*()" "$R7_WORKDIR/groups/$1" | cut -d\( -f1 + grep 2>/dev/null -e "^${pre}.*()" "$R7_WORKDIR/groups/$1" | cut -d\( -f1 done ) @@ -580,7 +580,7 @@ prefix() { _call() ( cd "$R7_WORKDIR" || return 2 - grep -e "^$2_.*()" "$1" | + grep -e "^$2.*()" "$1" | cut -d\( -f1 | while read -r function; do _debug "CALL $1 $function" echo trace "${1#*/}" "$function" START blob - 27e926306cae20ba89293c2a9ded04dd131bd94f blob + 814831e3dd7cf89aa31d2ebd01134e82a643cd37 --- r7.1 +++ r7.1 @@ -396,6 +396,20 @@ This will produce something like the following: /bin/sh: [155]: service: not found :: 1748791986 tools0 ERROR unable to setup service A .EE +.SS Cleaning functions +To remove a function from a group, we need to ensure that this function +returned 0 for the last execution. +.IP +.EX +state_function_to_remove() \f[B]{\f[R] + \f[I]# old code\f[R] + \f[I]# not used anymore\f[R] + : +\f[B]}\f[R] +.EE +.PP +This would prevent for seeing potential past errors caused by this +function in the summary output. .SS Using the r7 install functions The group library comes with the following functions that will allow installation of files and triggering actions if necessary: