diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2019-08-10 19:55:33 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2019-08-10 19:55:33 +0200 |
commit | a6031b01bfa3755438b83dd6b2608e8a69bee41c (patch) | |
tree | d57fffd8cabe0dad8c52b18154dc3abe443a21ea | |
parent | 6386880670fe668a98b8e18f46d54f690818aafa (diff) | |
download | builder-a6031b01bfa3755438b83dd6b2608e8a69bee41c.tar.xz |
manage-fail-reasons: improved output
-rwxr-xr-x | bin/manage-fail-reasons | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/manage-fail-reasons b/bin/manage-fail-reasons index f110889..eaa7ff5 100755 --- a/bin/manage-fail-reasons +++ b/bin/manage-fail-reasons @@ -23,15 +23,15 @@ case "$1" in # shellcheck disable=SC2016 fail_reason_identifiers=$( { - printf 'SELECT `fail_reasons`.`id`,`fail_reasons`.`severity`,replace(to_base64(`fail_reasons`.`identifier`),"\\n","")' + printf 'SELECT `fail_reasons`.`id`,name,`fail_reasons`.`severity`,replace(to_base64(`fail_reasons`.`identifier`),"\\n","")' printf ' FROM `fail_reasons` ORDER BY `fail_reasons`.`severity` ASC, `fail_reasons`.id ASC' } | \ mysql_run_query ) printf '%s\n' "${fail_reason_identifiers}" | \ - while read -r reason_id severity identifier; do + while read -r reason_id name severity identifier; do ident=$(printf '%s' "${identifier}" | base64 -d -) - printf "%02s %03s %s\n" "$reason_id" "$severity" "$ident" + printf "%s %s %s %s\n" "$reason_id" "$name" "$severity" "$ident" done ;; 'check') @@ -53,13 +53,13 @@ case "$1" in esac fail_reason_identifiers=$( { - printf 'SELECT id,severity,replace(to_base64(`fail_reasons`.`identifier`),"\\n","")' + printf 'SELECT id,severity,name,replace(to_base64(`fail_reasons`.`identifier`),"\\n","")' printf ' FROM `fail_reasons` ORDER BY `fail_reasons`.`severity` ASC, `fail_reasons`.id ASC' } | \ mysql_run_query ) printf '%s\n' "${fail_reason_identifiers}" | \ - while read -r id severity identifier; do + while read -r id severity name identifier; do if zgrep -qx "\s*$( printf '%s' "${identifier}" | \ base64 -d @@ -67,9 +67,10 @@ case "$1" in "$filelog"; then echo 'match' ident=$(printf '%s' "${identifier}" | base64 -d -) - printf "$id ($ident) matches with severity $severity\n" + printf "$name ($id, $ident) matches with severity $severity\n" fi done + zcat "$filelog" | tail -n 4 ;; *) >&2 printf 'unknown action "%s"\n' "$1" |