Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/ping-from-slave
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-04-02 22:03:54 +0200
committerErich Eckner <git@eckner.net>2018-04-02 22:03:54 +0200
commit3edeeb61fed2a7adcd8766818cdbae90b27d9fe6 (patch)
tree03bd71b868060a029d7e203d51bdcffc7270d808 /bin/ping-from-slave
parenta1b9a4f23603f7c913014d058d46313a1196cd91 (diff)
bin/ping-from-slave: save build_slaves.last_action
Diffstat (limited to 'bin/ping-from-slave')
-rwxr-xr-xbin/ping-from-slave39
1 files changed, 24 insertions, 15 deletions
diff --git a/bin/ping-from-slave b/bin/ping-from-slave
index 80ec46a..3c03b45 100755
--- a/bin/ping-from-slave
+++ b/bin/ping-from-slave
@@ -26,12 +26,20 @@ fi
log_lines=$(cat)
-if [ -n "${log_lines}" ]; then
- # shellcheck disable=SC2016
- {
- printf 'UPDATE `build_slaves`'
- printf ' SET `build_slaves`.`logged_lines`=from_base64("%s")' \
+# shellcheck disable=SC2016
+{
+ printf 'UPDATE `build_slaves`'
+ printf ' SET'
+ printf ' `build_slaves`.`last_action`=from_base64("%s")' \
+ "$(
+ printf '%s' "$1" | \
+ base64 -w0
+ )"
+
+ printf ', `build_slaves`.`logged_lines`='
+ if [ -n "${log_lines}" ]; then
+ printf 'from_base64("%s")' \
"$(
printf '%s' "$((
$(
@@ -41,13 +49,14 @@ if [ -n "${log_lines}" ]; then
)0))" | \
base64 -w0
)"
- printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \
- "$(
- printf '%s' "${slave}" | \
- base64 -w0
- )"
- } | \
- tee /tmp/ping-from-slave.query | \
- mysql_run_query 'unimportant'
-
-fi
+ else
+ printf 'NULL'
+ fi
+
+ printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \
+ "$(
+ printf '%s' "${slave}" | \
+ base64 -w0
+ )"
+} | \
+ mysql_run_query 'unimportant'