1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

ctdb-scripts: Move event scripts to events/legacy/ directory

This is the initial location that will be used by the new
multi-component aware event daemon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2018-05-15 13:39:15 +10:00 committed by Amitay Isaacs
parent 0f5d93a0ba
commit 12fd8d7a5c
30 changed files with 20 additions and 18 deletions

1
ctdb/.gitignore vendored
View File

@ -22,7 +22,6 @@ public_addresses.txt
rec.lock
test.db
tests/bin
tests/events.d/00.ctdb_test_trigger
tests/var
tests/takeover/ctdb_takeover.pyc
tests/eventscripts/var

View File

@ -6,9 +6,9 @@ Selected highlights:
An initscript for starting ctdbd at boot time.
events.d/
events/
Eventscripts. See events.d/README for more details.
Eventscripts. See events/README for more details.
functions

View File

@ -1,8 +1,11 @@
The events.d/ directory contains event scripts used by CTDB. Event
The events/ directory contains event scripts used by CTDB. Event
scripts are triggered on certain events, such as startup, monitoring
or public IP allocation. Scripts may be specific to services,
networking or internal CTDB operations.
Scripts are divided into subdirectories for different CTDB components.
Right now the only component is "legacy".
All event scripts start with the prefix 'NN.' where N is a digit. The
event scripts are run in sequence based on NN. Thus 10.interface will
be run before 60.nfs. It is recommended to keep each NN unique.

View File

@ -64,7 +64,7 @@ load_script_options ()
fi
if [ -n "$_script" ] ; then
_s="${CTDB_BASE}/events.d/${_script}"
_s="${CTDB_BASE}/events/legacy/${_script}"
else
_s="${0%.script}"
fi

View File

@ -131,8 +131,8 @@ install -m755 config/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/notify.d
# This is a hack. All documents should be installed in /usr/share/doc.
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events.d/README
cp config/events.d/README README.eventscripts
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events/README
cp config/events/README README.eventscripts
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/nfs-checks.d/README
cp config/nfs-checks.d/README README.nfs-checks.d
cp config/notify.d.README README.notify.d
@ -179,8 +179,8 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/sudoers.d/ctdb
%dir %{_sysconfdir}/ctdb
%{_sysconfdir}/ctdb/functions
%dir %{_sysconfdir}/ctdb/events.d
%{_sysconfdir}/ctdb/events.d/*
%dir %{_sysconfdir}/ctdb/events
%{_sysconfdir}/ctdb/events/*
%dir %{_sysconfdir}/ctdb/nfs-checks.d
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/00.portmapper.check
%config(noreplace) %{_sysconfdir}/ctdb/nfs-checks.d/10.status.check

View File

@ -350,7 +350,7 @@ int main(int argc, const char *argv[])
ctdb_tunables_set_defaults(ctdb);
ctdb->event_script_dir = talloc_asprintf(ctdb,
"%s/events.d",
"%s/events/legacy",
ctdb_base);
if (ctdb->event_script_dir == NULL) {
DBG_ERR("Out of memory\n");

View File

@ -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.d/99.timeout monitor
99\\.timeout,.* /etc/ctdb/events/legacy/99.timeout monitor
*\`-sleep,.*
---- Stack trace of interesting process [0-9]*\\[sleep\\] ----
[<[0-9a-f]*>] .*sleep+.*

View File

@ -40,7 +40,7 @@ else
fi
setup_ctdb_base "$EVENTSCRIPTS_TESTS_VAR_DIR" "etc-ctdb" \
events.d \
events \
functions \
nfs-checks.d \
nfs-linux-kernel-callout \
@ -85,7 +85,7 @@ setup_script_options ()
fi
if [ -n "$_script" ] ; then
_options="${CTDB_BASE}/events.d/${_script}.options"
_options="${CTDB_BASE}/events/legacy/${_script}.options"
else
_options="${script_dir}/${script%.script}.options"
fi
@ -458,12 +458,12 @@ define_test ()
[0-9][0-9].*.*)
script="${_f%.*}"
event="${_f##*.}"
script_dir="${CTDB_BASE}/events.d"
script_dir="${CTDB_BASE}/events/legacy"
;;
[0-9][0-9].*)
script="$_f"
unset event
script_dir="${CTDB_BASE}/events.d"
script_dir="${CTDB_BASE}/events/legacy"
;;
*.*)
script="${_f%.*}"

View File

@ -4,4 +4,4 @@
define_test "event scripts"
shellcheck_test "${CTDB_SCRIPTS_BASE}/events.d"/[0-9][0-9].*
shellcheck_test "${CTDB_SCRIPTS_BASE}/events/"*/[0-9][0-9].*

View File

@ -137,7 +137,7 @@ setup_ctdb ()
done
if $no_event_scripts ; then
rm -vf "${CTDB_BASE}/events.d/"*
rm -vf "${CTDB_BASE}/events/legacy/"*
fi
cat >"${CTDB_BASE}/ctdb.conf" <<EOF

View File

@ -731,7 +731,7 @@ def build(bld):
return pd['file_list']
etc_subdirs = [
'events.d',
'events/legacy',
'nfs-checks.d'
]