Skip to content
Snippets Groups Projects

Better fixing for journal parsing

Merged Walter Lozano requested to merge wip/wlozano/journal-fix-again into apertis/v2024dev3
All threads resolved!
+ 6
31
@@ -124,32 +124,6 @@ apply_update_sync()
# and if the handler quits, AUM reboots. And if AUM reboots, LAVA timeouts.
nohup updatectl --register-upgrade-handler & UPGRADEHANDLERPID=$!
# Wait for the "Starting Apertis update manager" log to appear before continuing
# or timeout
AUM_RESTARTED=0
for i in $(seq 0 5); do
sleep 5
if journalctl --after-cursor "${CURSOR}" --unit apertis-update-manager | grep -qE "Starting apertis-update-manager.service" ; then
AUM_RESTARTED=1
break
fi
done
if [ "$AUM_RESTARTED" = 0 ] ; then
echo "AUM did not restart"
RESULT=99
# kill the upgrade handler
# Requires update-manager 0.1812.1 to avoid reboot when
# the handler disconnects
kill $UPGRADEHANDLERPID
# Terminate journal logging
kill $JOURNALPID
# Do not use exit in functions because it prevents lava to terminate
return $RESULT
fi
# Update the cursor to catch events after restart
CURSOR="$(journalctl --show-cursor --unit apertis-update-manager -n 0 -o cat)"
CURSOR="${CURSOR#-- cursor: }"
@@ -179,16 +153,17 @@ apply_update_sync()
RESULT=1
break
fi
if journalctl --after-cursor "${CURSOR}" --unit apertis-update-manager | grep -qE "Starting apertis-update-manager.service" ; then
echo "AUM crashed"
RESULT=99
break
fi
if journalctl --after-cursor "${CURSOR}" --unit apertis-update-manager | grep -qE "Ostree upgrade ready, system should be rebooted" ; then
echo "ok"
RESULT=0
break
fi
n_restart=`journalctl --after-cursor "${CURSOR}" --unit apertis-update-manager | grep -E "Starting apertis-update-manager.service" | wc -l`
if [ $n_restart -gt 1 ] ; then
echo "AUM crashed"
RESULT=99
break
fi
done
# kill the upgrade handler
Loading