Colo verbosity (#6473)

automerge
This commit is contained in:
Trent Nelson
2019-10-21 14:49:12 -06:00
committed by Grimes
parent 84e911361a
commit 934f69b660

View File

@ -83,7 +83,10 @@ colo_instance_run() {
set -e set -e
while read -r LINE; do while read -r LINE; do
echo -e "$IP\v$RC\v$LINE" echo -e "$IP\v$RC\v$LINE"
done <<< "$OUT" if [[ "$RC" -ne 0 ]]; then
echo "IP(${IP}) Err(${RC}) LINE(${LINE})" 1>&2
fi
done < <(tr -d $'\r' <<<"$OUT")
return $RC return $RC
} }
@ -108,18 +111,19 @@ colo_instance_run_foreach() {
} }
colo_whoami() { colo_whoami() {
declare ME LINE SOL_USER declare ME LINE SOL_USER EOL
while read -r LINE; do while read -r LINE; do
declare IP RC declare IP RC
IFS=$'\v' read -r IP RC SOL_USER <<< "$LINE" IFS=$'\v' read -r IP RC SOL_USER EOL <<< "$LINE"
if [ "$RC" -eq 0 ]; then if [ "$RC" -eq 0 ]; then
[[ "$EOL" = "EOL" ]] || echo "${FUNCNAME[0]}: Unexpected input \"$LINE\"" 1>&2
if [ -z "$ME" ] || [ "$ME" = "$SOL_USER" ]; then if [ -z "$ME" ] || [ "$ME" = "$SOL_USER" ]; then
ME="$SOL_USER" ME="$SOL_USER"
else else
echo "Found conflicting username \"$SOL_USER\" on $IP, expected \"$ME\"" 1>&2 echo "Found conflicting username \"$SOL_USER\" on $IP, expected \"$ME\"" 1>&2
fi fi
fi fi
done < <(colo_instance_run_foreach "[ -n \"\$SOLANA_USER\" ] && echo \"\$SOLANA_USER\"") done < <(colo_instance_run_foreach "[ -n \"\$SOLANA_USER\" ] && echo -e \"\$SOLANA_USER\\vEOL\"")
echo "$ME" echo "$ME"
} }
@ -138,16 +142,17 @@ __colo_node_status_script() {
# the time due to $SOLANA_LOCK_FILE not existing and is running from a # the time due to $SOLANA_LOCK_FILE not existing and is running from a
# subshell where normal redirection doesn't work # subshell where normal redirection doesn't work
exec 9<"$SOLANA_LOCK_FILE" && flock -s 9 && . "$SOLANA_LOCK_FILE" && exec 9>&- exec 9<"$SOLANA_LOCK_FILE" && flock -s 9 && . "$SOLANA_LOCK_FILE" && exec 9>&-
echo -e "\$SOLANA_LOCK_USER\\v\$SOLANA_LOCK_INSTANCENAME" echo -e "\$SOLANA_LOCK_USER\\v\$SOLANA_LOCK_INSTANCENAME\\vEOL"
exec 2>&3 # Restore stderr exec 2>&3 # Restore stderr
EOF EOF
} }
__colo_node_status_result_normalize() { __colo_node_status_result_normalize() {
declare IP RC US BY INSTNAME declare IP RC US BY INSTNAME EOL
declare ST="DOWN" declare ST="DOWN"
IFS=$'\v' read -r IP RC US INSTNAME <<< "$1" IFS=$'\v' read -r IP RC US INSTNAME EOL <<< "$1"
if [ "$RC" -eq 0 ]; then if [ "$RC" -eq 0 ]; then
[[ "$EOL" = "EOL" ]] || echo "${FUNCNAME[0]}: Unexpected input \"$1\"" 1>&2
if [ -n "$US" ]; then if [ -n "$US" ]; then
BY="$US" BY="$US"
ST="HELD" ST="HELD"