ctdb-scripts: Event scripts must end with ".script" suffix
authorMartin Schwenke <martin@meltin.net>
Tue, 15 May 2018 08:36:29 +0000 (18:36 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 5 Jun 2018 15:47:26 +0000 (17:47 +0200)
Preparation for recommending configuration for each script next to the
actual script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
44 files changed:
ctdb/common/run_event.c
ctdb/config/events/legacy/00.ctdb.script [moved from ctdb/config/events/legacy/00.ctdb with 100% similarity]
ctdb/config/events/legacy/01.reclock.script [moved from ctdb/config/events/legacy/01.reclock with 100% similarity]
ctdb/config/events/legacy/05.system.script [moved from ctdb/config/events/legacy/05.system with 100% similarity]
ctdb/config/events/legacy/06.nfs.script [moved from ctdb/config/events/legacy/06.nfs with 100% similarity]
ctdb/config/events/legacy/10.interface.script [moved from ctdb/config/events/legacy/10.interface with 100% similarity]
ctdb/config/events/legacy/11.natgw.script [moved from ctdb/config/events/legacy/11.natgw with 100% similarity]
ctdb/config/events/legacy/11.routing.script [moved from ctdb/config/events/legacy/11.routing with 100% similarity]
ctdb/config/events/legacy/13.per_ip_routing.script [moved from ctdb/config/events/legacy/13.per_ip_routing with 100% similarity]
ctdb/config/events/legacy/20.multipathd.script [moved from ctdb/config/events/legacy/20.multipathd with 100% similarity]
ctdb/config/events/legacy/31.clamd.script [moved from ctdb/config/events/legacy/31.clamd with 100% similarity]
ctdb/config/events/legacy/40.vsftpd.script [moved from ctdb/config/events/legacy/40.vsftpd with 100% similarity]
ctdb/config/events/legacy/41.httpd.script [moved from ctdb/config/events/legacy/41.httpd with 100% similarity]
ctdb/config/events/legacy/49.winbind.script [moved from ctdb/config/events/legacy/49.winbind with 100% similarity]
ctdb/config/events/legacy/50.samba.script [moved from ctdb/config/events/legacy/50.samba with 100% similarity]
ctdb/config/events/legacy/60.nfs.script [moved from ctdb/config/events/legacy/60.nfs with 100% similarity]
ctdb/config/events/legacy/70.iscsi.script [moved from ctdb/config/events/legacy/70.iscsi with 100% similarity]
ctdb/config/events/legacy/91.lvs.script [moved from ctdb/config/events/legacy/91.lvs with 100% similarity]
ctdb/config/events/legacy/99.timeout.script [moved from ctdb/config/events/legacy/99.timeout with 100% similarity]
ctdb/tests/complex/90_debug_hung_script.sh
ctdb/tests/cunit/run_event_001.sh
ctdb/tests/eventd/eventd_002.sh
ctdb/tests/eventd/eventd_003.sh
ctdb/tests/eventd/eventd_004.sh
ctdb/tests/eventd/eventd_005.sh
ctdb/tests/eventd/eventd_006.sh
ctdb/tests/eventd/eventd_007.sh
ctdb/tests/eventd/eventd_011.sh
ctdb/tests/eventd/eventd_012.sh
ctdb/tests/eventd/eventd_013.sh
ctdb/tests/eventd/eventd_014.sh
ctdb/tests/eventd/eventd_021.sh
ctdb/tests/eventd/eventd_022.sh
ctdb/tests/eventd/eventd_023.sh
ctdb/tests/eventd/eventd_024.sh
ctdb/tests/eventd/eventd_031.sh
ctdb/tests/eventd/eventd_032.sh
ctdb/tests/eventd/eventd_033.sh
ctdb/tests/eventd/eventd_041.sh
ctdb/tests/eventd/eventd_042.sh
ctdb/tests/eventd/eventd_043.sh
ctdb/tests/eventd/eventd_051.sh
ctdb/tests/eventscripts/scripts/local.sh
ctdb/tests/simple/etc-ctdb/events/legacy/00.test.script [moved from ctdb/tests/simple/etc-ctdb/events/legacy/00.test with 100% similarity]

index e230b12..b1b50ec 100644 (file)
@@ -20,7 +20,7 @@
 #include "replace.h"
 #include "system/filesys.h"
 #include "system/dir.h"
-#include "system/locale.h"
+#include "system/glob.h"
 #include "system/wait.h"
 
 #include <talloc.h>
 
 static int script_filter(const struct dirent *de)
 {
-       size_t namelen = strlen(de->d_name);
-       char *ptr;
-
-       /* Ignore . and .. */
-       if (namelen < 3) {
-               return 0;
-       }
-
-       /* Skip filenames with ~ */
-       ptr = strchr(de->d_name, '~');
-       if (ptr != NULL) {
-               return 0;
-       }
-
-       /* Filename should start with [0-9][0-9]. */
-       if ((! isdigit(de->d_name[0])) ||
-           (! isdigit(de->d_name[1])) ||
-           (de->d_name[2] != '.')) {
-               return 0;
-       }
+       int ret;
 
-       /* Ignore filenames with multiple '.'s */
-       ptr = index(&de->d_name[3], '.');
-       if (ptr != NULL) {
-               return 0;
+       /* Match a script pattern */
+       ret = fnmatch("[0-9][0-9].*.script", de->d_name, 0);
+       if (ret == 0) {
+               return 1;
        }
 
-       return 1;
+       return 0;
 }
 
 static int get_script_list(TALLOC_CTX *mem_ctx,
@@ -75,6 +56,7 @@ static int get_script_list(TALLOC_CTX *mem_ctx,
 {
        struct dirent **namelist = NULL;
        struct run_event_script_list *script_list;
+       size_t ls;
        int count, ret;
        int i;
 
@@ -113,10 +95,13 @@ static int get_script_list(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
+       ls = strlen(".script");
        for (i=0; i<count; i++) {
                struct run_event_script *s = &script_list->script[i];
 
-               s->name = talloc_strdup(script_list, namelist[i]->d_name);
+               s->name = talloc_strndup(script_list,
+                                        namelist[i]->d_name,
+                                        strlen(namelist[i]->d_name) - ls);
                if (s->name == NULL) {
                        ret = ENOMEM;
                        talloc_free(script_list);
@@ -142,12 +127,21 @@ static int script_chmod(TALLOC_CTX *mem_ctx, const char *script_dir,
 {
        DIR *dirp;
        struct dirent *de;
+       char script_file[PATH_MAX];
        int ret, new_mode;
        char *filename;
        struct stat st;
        bool found;
        int fd = -1;
 
+       ret = snprintf(script_file,
+                      sizeof(script_file),
+                      "%s.script",
+                      script_name);
+       if (ret >= sizeof(script_file)) {
+               return ENAMETOOLONG;
+       }
+
        dirp = opendir(script_dir);
        if (dirp == NULL) {
                return errno;
@@ -155,7 +149,7 @@ static int script_chmod(TALLOC_CTX *mem_ctx, const char *script_dir,
 
        found = false;
        while ((de = readdir(dirp)) != NULL) {
-               if (strcmp(de->d_name, script_name) == 0) {
+               if (strcmp(de->d_name, script_file) == 0) {
 
                        /* check for valid script names */
                        ret = script_filter(de);
@@ -174,7 +168,7 @@ static int script_chmod(TALLOC_CTX *mem_ctx, const char *script_dir,
                return ENOENT;
        }
 
-       filename = talloc_asprintf(mem_ctx, "%s/%s", script_dir, script_name);
+       filename = talloc_asprintf(mem_ctx, "%s/%s", script_dir, script_file);
        if (filename == NULL) {
                return ENOMEM;
        }
@@ -422,7 +416,7 @@ int run_event_script_list(struct run_event_context *run_ctx,
                struct stat st;
                char *path = NULL;
 
-               path = talloc_asprintf(mem_ctx, "%s/%s",
+               path = talloc_asprintf(mem_ctx, "%s/%s.script",
                                       run_event_script_dir(run_ctx),
                                       script->name);
                if (path == NULL) {
@@ -779,7 +773,7 @@ static struct tevent_req *run_event_run_script(struct tevent_req *req)
 
        script = &state->script_list->script[state->index];
 
-       path = talloc_asprintf(state, "%s/%s",
+       path = talloc_asprintf(state, "%s/%s.script",
                               run_event_script_dir(state->run_ctx),
                               script->name);
        if (path == NULL) {
index fc44bad..797f007 100755 (executable)
@@ -84,7 +84,7 @@ done <<'EOF'
 ===== Start of hung script debug for PID=".*", event="monitor" =====
 ===== End of hung script debug for PID=".*", event="monitor" =====
 pstree -p -a .*:
-99\\.timeout,.* /etc/ctdb/events/legacy/99.timeout monitor
+99\\.timeout\\.scri,.* /etc/ctdb/events/legacy/99\\.timeout\\.script monitor
  *\`-sleep,.*
 ---- Stack trace of interesting process [0-9]*\\[sleep\\] ----
 [<[0-9a-f]*>] .*sleep+.*
index 35c256b..f8f74fb 100755 (executable)
@@ -22,14 +22,15 @@ cat > "$scriptdir/prog" <<EOF
 echo hello
 EOF
 
-# Invalid script
+# Invalid script, doesn't end in ".script"
 ok <<EOF
 No event scripts found
 EOF
 unit_test run_event_test "$scriptdir" list
 
+# Is not found because enabling "prog" actually looks for "prog.script"
 ok <<EOF
-Script enable prog completed with result=22
+Script enable prog completed with result=2
 EOF
 unit_test run_event_test "$scriptdir" enable prog
 
@@ -37,28 +38,7 @@ required_result 1 <<EOF
 EOF
 unit_test test -x "${scriptdir}/prog"
 
-cat > "$scriptdir/10.test.rpmnew" <<EOF
-#!/bin/sh
-
-echo hello
-EOF
-chmod +x "$scriptdir/10.test.rpmnew"
-
-# Invalid script with multiple '.'s
-ok <<EOF
-No event scripts found
-EOF
-unit_test run_event_test "$scriptdir" list
-
-ok <<EOF
-Script disable 10.test.rpmnew completed with result=22
-EOF
-unit_test run_event_test "$scriptdir" disable 10.test.rpmnew
-
-ok_null
-unit_test test -x "${scriptdir}/10.test.rpmnew"
-
-cat > "$scriptdir/11.foo" <<EOF
+cat > "$scriptdir/11.foo.script" <<EOF
 #!/bin/sh
 
 echo hello
@@ -77,7 +57,7 @@ unit_test run_event_test "$scriptdir" enable 11.foo
 
 ok <<EOF
 EOF
-unit_test test -x "${scriptdir}/11.foo"
+unit_test test -x "${scriptdir}/11.foo.script"
 
 ok <<EOF
 11.foo: hello
@@ -86,7 +66,7 @@ Event monitor completed with result=0
 EOF
 unit_test run_event_test "$scriptdir" run 10 monitor
 
-cat > "$scriptdir/22.bar" <<EOF
+cat > "$scriptdir/22.bar.script" <<EOF
 #!/bin/sh
 
 exit 1
@@ -120,7 +100,7 @@ unit_test run_event_test "$scriptdir" disable 22.bar
 
 required_result 1 <<EOF
 EOF
-unit_test test -x "${scriptdir}/22.bar"
+unit_test test -x "${scriptdir}/22.bar.script"
 
 ok <<EOF
 11.foo: hello
@@ -130,7 +110,7 @@ Event monitor completed with result=0
 EOF
 unit_test run_event_test "$scriptdir" run 10 monitor
 
-cat > "$scriptdir/22.bar" <<EOF
+cat > "$scriptdir/22.bar.script" <<EOF
 #!/bin/sh
 
 sleep 10
@@ -152,4 +132,3 @@ unit_test run_event_test "$scriptdir" run 5 monitor
 
 rm -rf "$scriptdir"
 exit 0
-
index f4af692..ee0f8f3 100755 (executable)
@@ -6,9 +6,9 @@ define_test "eventscript directory with random files"
 
 setup_eventd
 
-touch "$eventd_scriptdir/README"
+touch "$eventd_scriptdir/README.script"
 
-cat > "$eventd_scriptdir/a.sh" <<EOF
+cat > "$eventd_scriptdir/a.script" <<EOF
 #!/bin/sh
 
 exit 1
@@ -25,9 +25,9 @@ EOF
 simple_test script enable README
 
 required_result 22 <<EOF
-Script name a.sh is invalid
+Script name a is invalid
 EOF
-simple_test script disable a.sh
+simple_test script disable a
 
 required_result 2 <<EOF
 Script 00.test does not exist
index 49f1d32..8f087f8 100755 (executable)
@@ -6,7 +6,7 @@ define_test "disabled event script"
 
 setup_eventd
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 exit 0
index 74aa82c..31af397 100755 (executable)
@@ -6,7 +6,7 @@ define_test "enabled event script"
 
 setup_eventd
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 exit 0
index 0b803ae..0097bc5 100755 (executable)
@@ -6,12 +6,12 @@ define_test "failing event script"
 
 setup_eventd
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 exit 1
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 required_result 1 <<EOF
 Failed to run event monitor, result=1
index c540bf3..09d8813 100755 (executable)
@@ -6,13 +6,13 @@ define_test "timing out event script"
 
 setup_eventd
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 sleep 10
 exit 0
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 required_result 62 <<EOF
 Event monitor timed out
index fee60fe..2c99046 100755 (executable)
@@ -6,13 +6,13 @@ define_test "capture event script output"
 
 setup_eventd
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 echo "args: \$*"
 exit 1
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 required_result 1 <<EOF
 Failed to run event monitor, result=1
index d600e4f..d05de53 100755 (executable)
@@ -6,7 +6,7 @@ define_test "multiple events"
 
 setup_eventd
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 echo "args: \$*"
@@ -20,7 +20,7 @@ monitor)
        ;;
 esac
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 required_result 0 <<EOF
 EOF
index f750b19..9154d8f 100755 (executable)
@@ -6,12 +6,12 @@ define_test "cancel new monitor event"
 
 setup_eventd
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 sleep 5
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 required_result 0 <<EOF
 EOF
index 0c581b3..d80ecf0 100755 (executable)
@@ -6,12 +6,12 @@ define_test "cancel running monitor event"
 
 setup_eventd
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 sleep 5
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 required_result 125 <<EOF
 Event monitor got cancelled
index 1069d75..56e728c 100755 (executable)
@@ -6,12 +6,12 @@ define_test "queue events"
 
 setup_eventd
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 sleep 5
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 required_result 0 <<EOF
 EOF
index e2368b0..feaf868 100755 (executable)
@@ -4,12 +4,12 @@
 
 define_test "debug script"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 sleep 99
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 cat > "$eventd_scriptdir/debug.sh" <<EOF
 #!/bin/sh
index ee74e88..f85b435 100755 (executable)
@@ -4,13 +4,13 @@
 
 define_test "status output in debug script"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 echo "Sleeping for 99 seconds"
 sleep 99
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 cat > "$eventd_scriptdir/debug.sh" <<EOF
 #!/bin/sh
@@ -33,7 +33,7 @@ simple_test run monitor 5
 sleep 5
 
 required_result 0 <<EOF
-01.test,PID $eventd_scriptdir/01.test monitor
+01.test.script,PID $eventd_scriptdir/01.test.script monitor
   \`-sleep,PID 99
 01.test              TIMEDOUT   DATETIME
   OUTPUT: Sleeping for 99 seconds
index 264a281..9ed2f92 100755 (executable)
@@ -4,13 +4,13 @@
 
 define_test "redirected status output in debug script"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 echo "Sleeping for 99 seconds"
 sleep 99
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 cat > "$eventd_scriptdir/debug.sh" <<EOF
 #!/bin/sh
index 04a5d00..38ebfa9 100755 (executable)
@@ -4,13 +4,13 @@
 
 define_test "process terminated after debug"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 echo "Sleeping for 99 seconds"
 sleep 99
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 cat > "$eventd_scriptdir/debug.sh" <<EOF
 #!/bin/sh
index 5157bce..ab7d7ad 100755 (executable)
@@ -4,14 +4,14 @@
 
 define_test "multiple scripts"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 sleep 1
 EOF
 
-cp "$eventd_scriptdir/01.test" "$eventd_scriptdir/02.test"
-cp "$eventd_scriptdir/01.test" "$eventd_scriptdir/03.test"
+cp "$eventd_scriptdir/01.test.script" "$eventd_scriptdir/02.test.script"
+cp "$eventd_scriptdir/01.test.script" "$eventd_scriptdir/03.test.script"
 
 setup_eventd
 
index 6d02283..96b4d54 100755 (executable)
@@ -4,7 +4,7 @@
 
 define_test "failures with multiple scripts"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 case "\$1" in
@@ -17,9 +17,9 @@ monitor|ipreallocated)
 esac
 
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
-cat > "$eventd_scriptdir/02.test" <<EOF
+cat > "$eventd_scriptdir/02.test.script" <<EOF
 #!/bin/sh
 
 case "\$1" in
@@ -32,9 +32,9 @@ startup|ipreallocated)
 esac
 
 EOF
-chmod +x "$eventd_scriptdir/02.test"
+chmod +x "$eventd_scriptdir/02.test.script"
 
-cat > "$eventd_scriptdir/03.test" <<EOF
+cat > "$eventd_scriptdir/03.test.script" <<EOF
 #!/bin/sh
 
 case "\$1" in
@@ -47,7 +47,7 @@ startup|monitor)
 esac
 
 EOF
-chmod +x "$eventd_scriptdir/03.test"
+chmod +x "$eventd_scriptdir/03.test.script"
 
 setup_eventd
 
index 6b69055..724bdb3 100755 (executable)
@@ -4,7 +4,7 @@
 
 define_test "timeouts with multiple scripts"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 case "\$1" in
@@ -17,9 +17,9 @@ monitor|ipreallocated)
 esac
 
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
-cat > "$eventd_scriptdir/02.test" <<EOF
+cat > "$eventd_scriptdir/02.test.script" <<EOF
 #!/bin/sh
 
 case "\$1" in
@@ -32,9 +32,9 @@ startup|ipreallocated)
 esac
 
 EOF
-chmod +x "$eventd_scriptdir/02.test"
+chmod +x "$eventd_scriptdir/02.test.script"
 
-cat > "$eventd_scriptdir/03.test" <<EOF
+cat > "$eventd_scriptdir/03.test.script" <<EOF
 #!/bin/sh
 
 case "\$1" in
@@ -47,7 +47,7 @@ startup|monitor)
 esac
 
 EOF
-chmod +x "$eventd_scriptdir/03.test"
+chmod +x "$eventd_scriptdir/03.test.script"
 
 setup_eventd
 
index a10926f..581f30c 100755 (executable)
@@ -4,7 +4,7 @@
 
 define_test "takeip event"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 echo \$*
@@ -14,7 +14,7 @@ if [ \$# -ne 4 ] ; then
 fi
 exit 0
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 setup_eventd
 
index 19a30d7..c99832b 100755 (executable)
@@ -4,7 +4,7 @@
 
 define_test "releaseip event"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 echo \$*
@@ -14,7 +14,7 @@ if [ \$# -ne 4 ] ; then
 fi
 exit 0
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 setup_eventd
 
index d347c63..6ca409f 100755 (executable)
@@ -4,7 +4,7 @@
 
 define_test "updateip event"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 echo \$*
@@ -14,7 +14,7 @@ if [ \$# -ne 5 ] ; then
 fi
 exit 0
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 setup_eventd
 
index 46162de..8993984 100755 (executable)
@@ -4,12 +4,12 @@
 
 define_test "logging check"
 
-cat > "$eventd_scriptdir/01.test" <<EOF
+cat > "$eventd_scriptdir/01.test.script" <<EOF
 #!/bin/sh
 
 echo "Running event \$1"
 EOF
-chmod +x "$eventd_scriptdir/01.test"
+chmod +x "$eventd_scriptdir/01.test.script"
 
 setup_eventd
 
index 3f6bf16..e374dcd 100644 (file)
@@ -456,12 +456,12 @@ define_test ()
 
     case "$_f" in
        [0-9][0-9].*.*)
-           script="${_f%.*}"
+           script="${_f%.*}.script"
            event="${_f##*.}"
            script_dir="${CTDB_BASE}/events/legacy"
            ;;
        [0-9][0-9].*)
-           script="$_f"
+           script="${_f}.script"
            unset event
            script_dir="${CTDB_BASE}/events/legacy"
            ;;
@@ -479,9 +479,11 @@ define_test ()
     [ -r "${script_dir}/${script}" ] || \
        die "Internal error - unable to find script \"${script_dir}/${script}\""
 
-    printf "%-17s %-10s %-4s - %s\n\n" "$script" "$event" "$_num" "$desc"
+    script_short="${script%.script}"
+
+    printf "%-17s %-10s %-4s - %s\n\n" "$script_short" "$event" "$_num" "$desc"
 
-    _f="${TEST_SUBDIR}/scripts/${script}.sh"
+    _f="${TEST_SUBDIR}/scripts/${script_short}.sh"
     if [ -r "$_f" ] ; then
            . "$_f"
     fi