diff options
author | Erich Eckner <git@eckner.net> | 2018-06-05 11:00:49 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-06-05 11:00:49 +0200 |
commit | cfb2186ac775752ba45d66f372ac367694fc4f31 (patch) | |
tree | 19a126f1d1c98f80584d19d52dd51f14daf31268 | |
parent | 45546b6a31e900d78fe2c0344636a2d132633e4f (diff) | |
download | builder-cfb2186ac775752ba45d66f372ac367694fc4f31.tar.xz |
bin/ping-from-slave: do not mark slave as insane if uploading-pinging
-rwxr-xr-x | bin/ping-from-slave | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/bin/ping-from-slave b/bin/ping-from-slave index a82a633..a12129f 100755 --- a/bin/ping-from-slave +++ b/bin/ping-from-slave @@ -30,25 +30,28 @@ if [ -z "${status}" ]; then fi if [ "${status% *}" != '1' ]; then - >&2 echo 'You do not build anything currently - abort whatever you are doing.' - if [ "${status#* }" = '1' ]; then - # shellcheck disable=SC2016 - { - printf 'UPDATE `build_slaves`' - printf ' SET `build_slaves`.`is_sane`=0' - printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \ - "$(printf '%s' "${slave}" | base64 -w0)" - printf 'SELECT CONCAT(' - printf '`persons`.`name`,": Your buildslave \\"",' - printf '`build_slaves`.`name`,"\\" builds some outdated package."' - printf ') FROM `build_slaves`' - mysql_join_build_slaves_ssh_keys - mysql_join_ssh_keys_persons - printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \ - "$(printf '%s' "${slave}" | base64 -w0)" - } | \ - mysql_run_query | \ - irc_say + # during upload, the job might already have been deleted from the database + if [ 'uploading' != "$1" ]; then + >&2 echo 'You do not build anything currently - abort whatever you are doing.' + if [ "${status#* }" = '1' ]; then + # shellcheck disable=SC2016 + { + printf 'UPDATE `build_slaves`' + printf ' SET `build_slaves`.`is_sane`=0' + printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \ + "$(printf '%s' "${slave}" | base64 -w0)" + printf 'SELECT CONCAT(' + printf '`persons`.`name`,": Your buildslave \\"",' + printf '`build_slaves`.`name`,"\\" builds some outdated package."' + printf ') FROM `build_slaves`' + mysql_join_build_slaves_ssh_keys + mysql_join_ssh_keys_persons + printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \ + "$(printf '%s' "${slave}" | base64 -w0)" + } | \ + mysql_run_query | \ + irc_say + fi fi exit 2 fi |