summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-08 13:41:46 +0200
committerErich Eckner <git@eckner.net>2018-09-08 13:41:46 +0200
commitcd56bf9ce6c64f511a3fae0cc86894cc25dd5a93 (patch)
treee6ae48b2ebcde6f88b6bb9c2d92b783ee4b1bc62
parentfbbb282fd5eb26b2c6f66c24e62ab98625ae3c3a (diff)
downloadbuilder-cd56bf9ce6c64f511a3fae0cc86894cc25dd5a93.tar.xz
move mysql sanity check from bin/build-master-status to bin/sanity-check
-rwxr-xr-xbin/build-master-status33
-rwxr-xr-xbin/sanity-check28
2 files changed, 27 insertions, 34 deletions
diff --git a/bin/build-master-status b/bin/build-master-status
index 5786fb8..bad971d 100755
--- a/bin/build-master-status
+++ b/bin/build-master-status
@@ -11,15 +11,12 @@ tmp_dir=$(mktemp -d 'tmp.build-master-status.XXXXXXXXXX' --tmpdir)
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
# do not block if locked
-exec 9> "${sanity_check_lock_file}"
+exec 9> "${status_lock_file}"
if ! verbose_flock -n 9; then
- >&2 echo 'Mysql-Sanity check skipped, cannot acquire lock.'
+ >&2 echo 'Saving status skipped, cannot acquire lock.'
exit
fi
-# shellcheck disable=SC2119
-mysql_cleanup
-
# update todos
find "${base_dir}/bin/" "${base_dir}/conf/" "${base_dir}/lib/" -type f \
-exec grep -nHF '' '{}' \; | \
@@ -99,32 +96,6 @@ if [ -s "${tmp_dir}/todos" ]; then
fi
rm -f "${tmp_dir}/todos"
-{
- mysql_sanity_check || true
-} | \
- sed '
- s,^-.*$,<font color="#FF0000">\0</font>,
- s,^+.*$,<font color="#00FF00">\0</font>,
- s/$/<br>/
- 1 i <html><head><title>sanity of the buildmaster'"'"'s mysql database</title></head><body>
- $ a </body></html>
- ' | \
- sponge "${webserver_directory}/mysql-sanity.html"
-
-if [ -s "${webserver_directory}/mysql-sanity.html" ] && \
- [ ! -s "${work_dir}/build-master-sanity" ]; then
- # shellcheck disable=SC2119
- {
- printf 'girls, my database is dirty again ...\n'
- printf 'dirty! girls, my database - so dirty :-(\n'
- printf 'girls, please have a look at my dirty database'
- } | \
- shuf -n1 | \
- irc_say
- echo 'build master is insane' > \
- "${work_dir}/build-master-sanity"
-fi
-
if [ ! -s "${work_dir}/build-master-sanity" ]; then
# shellcheck disable=SC2016
{
diff --git a/bin/sanity-check b/bin/sanity-check
index 1ebd86e..1069e17 100755
--- a/bin/sanity-check
+++ b/bin/sanity-check
@@ -7,8 +7,6 @@
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
-# TODO: move mysql sanity check from build-master-status to here
-
usage() {
>&2 echo ''
>&2 echo 'sanity-check [options] [checks]: check sanity of build master'
@@ -104,6 +102,8 @@ if ! verbose_flock ${block_flag} 9; then
exit
fi
+mysql_cleanup
+
finish() {
{
printf '%s\n' \
@@ -434,9 +434,31 @@ while [ $# -gt 0 ]; do
mysql)
[ ${silence} -gt 0 ] || \
- printf 'checking mysql-sanity-check-file ...' >> \
+ printf 'checking mysql-sanity ...' >> \
"${tmp_dir}/messages"
+ mysql_sanity_check | \
+ sed '
+ s,^-.*$,<font color="#FF0000">\0</font>,
+ s,^+.*$,<font color="#00FF00">\0</font>,
+ s/$/<br>/
+ 1 i <html><head><title>sanity of the buildmaster'"'"'s mysql database</title></head><body>
+ $ a </body></html>
+ ' | \
+ sponge "${webserver_directory}/mysql-sanity.html"
+
+ if [ -s "${webserver_directory}/mysql-sanity.html" ] && \
+ [ ! -s "${work_dir}/build-master-sanity" ]; then
+ # shellcheck disable=SC2119
+ {
+ printf 'girls, my database is dirty again ...\n'
+ printf 'dirty! girls, my database - so dirty :-(\n'
+ printf 'girls, please have a look at my dirty database'
+ } | \
+ shuf -n1 | \
+ irc_say
+ fi
+
if [ -s "${webserver_directory}/mysql-sanity.html" ]; then
if [ ${silence} -le 1 ]; then
printf '\nThere is something wrong with the database:\n'