summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-05-02 11:32:17 +0200
committerErich Eckner <git@eckner.net>2018-05-02 11:43:30 +0200
commit71e15c002d5596d84b52c05625478a2ed3123695 (patch)
treeda30997c5be5e283417cde93727c6a44cd3e9da4 /lib
parentfb4e4757f7ca9ea8c12ed97c1887bb67ebd5505f (diff)
downloadbuilder-71e15c002d5596d84b52c05625478a2ed3123695.tar.xz
lib/mysql-functions: remove residues of unimportant mysql queries in case of error
Diffstat (limited to 'lib')
-rwxr-xr-xlib/mysql-functions22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index dad6bc6..5ce7e0c 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -62,21 +62,27 @@ mysql_run_query() {
# a present query_file means there was an error
if [ -f "${query_stdin}" ]; then
>&2 printf 'I could not complete a mysql query!\n'
- if [ ! -s "${work_dir}/build-master-sanity" ]; then
+ if [ ! -s "${work_dir}/build-master-sanity" ] && \
+ [ -z "${file_name_extra}" ]; then
printf '\001ACTION failed to execute a mysql query - can you have a look at "%s"?.\001\n' \
"${query_stdin##*/}" \
| irc_say
- for file in \
- "${query_stdin}" \
- "${query_stdout}" \
- "${query_stderr}"; do
- cp "${file}" "${webserver_directory}/mysql-queries/${file##*/}.txt"
- chmod go+r "${webserver_directory}/mysql-queries/${file##*/}.txt"
- done
fi
+ for file in \
+ "${query_stdin}" \
+ "${query_stdout}" \
+ "${query_stderr}"; do
+ cp "${file}" "${webserver_directory}/mysql-queries/${file##*/}.txt"
+ chmod go+r "${webserver_directory}/mysql-queries/${file##*/}.txt"
+ done
if [ -z "${file_name_extra}" ]; then
echo 'A mysql query failed.' > \
"${work_dir}/build-master-sanity"
+ else
+ rm -f \
+ "${query_stdin}" \
+ "${query_stdout}" \
+ "${query_stderr}"
fi
return 2
fi