Merge pull request 'otbr: strip the CR from ot-ctl state before matching it' (#140) from fix/otbr-state-crlf into master
Reviewed-on: gitea_admin/homelab#140
This commit was merged in pull request #140.
This commit is contained in:
@@ -145,9 +145,16 @@ spec:
|
||||
# exists to prevent. Note the trailing `|| true`: this script
|
||||
# runs under `set -e`, so a bare failing test would kill the
|
||||
# container rather than log a warning.
|
||||
#
|
||||
# `tr -d '\r'` is load-bearing. ot-ctl speaks a serial-console
|
||||
# protocol and terminates lines with CRLF, so `ot-ctl state`
|
||||
# yields `leader\r` (7 bytes). That matches no shell glob, and
|
||||
# the stray CR is invisible in logs — the first cut of this
|
||||
# block printed "WARNING Thread not attached (state=leader)"
|
||||
# while Thread was, in fact, the leader.
|
||||
STATE=""
|
||||
for i in $(seq 1 30); do
|
||||
STATE=$(ot-ctl state 2>/dev/null | head -1 || true)
|
||||
STATE=$(ot-ctl state 2>/dev/null | head -1 | tr -d '\r' || true)
|
||||
case "$STATE" in
|
||||
leader|router|child)
|
||||
echo "otbr: Thread attached as ${STATE}"
|
||||
|
||||
Reference in New Issue
Block a user