fix(install.sh): Verifikation prüft gateway_state.json statt Journal-Grep
Problem: Journal-Grep suchte nur nach 'rocketchat.*connected' — wenn Telegram die einzige Plattform war (Discovery-Bug), galt die Verifikation trotzdem als erfolgreich. Fix: python3 liest gateway_state.json und prüft BEIDE Plattformen: rocketchat=connected UND telegram=connected. Erst dann gilt der Gateway-Start als erfolgreich. Robuster als Journal-Grep: state.json ist die Ground Truth, nicht Log-Zeilen die fehlen können.
This commit is contained in:
+22
-5
@@ -517,15 +517,32 @@ perform_update_only() {
|
|||||||
# Gateway starten
|
# Gateway starten
|
||||||
systemctl --user start hermes-gateway 2>/dev/null || true
|
systemctl --user start hermes-gateway 2>/dev/null || true
|
||||||
|
|
||||||
# 6. Verify Rocket.Chat connected (wait up to 60s — Gateway braucht länger nach Cleanup)
|
# 6. Verify BOTH platforms connected (gateway_state.json — robuster als Journal-Grep)
|
||||||
msg verifying
|
msg verifying
|
||||||
local verified=false
|
local verified=false
|
||||||
for i in $(seq 1 24); do
|
for i in $(seq 1 24); do
|
||||||
sleep 2.5
|
sleep 2.5
|
||||||
if journalctl --user -u hermes-gateway --since "60 seconds ago" --no-pager 2>/dev/null \
|
if [ -f "$HOME/.hermes/gateway_state.json" ]; then
|
||||||
| grep -qE "rocketchat.*connected|✓ rocketchat connected|Subscribed to.*[0-9]+ room"; then
|
local state_check
|
||||||
verified=true
|
state_check=$(python3 -c "
|
||||||
break
|
import json, sys
|
||||||
|
try:
|
||||||
|
with open('$HOME/.hermes/gateway_state.json') as f:
|
||||||
|
d = json.load(f)
|
||||||
|
platforms = d.get('platforms', {})
|
||||||
|
rc = platforms.get('rocketchat', {}).get('state', '')
|
||||||
|
tg = platforms.get('telegram', {}).get('state', '')
|
||||||
|
if rc == 'connected' and tg == 'connected':
|
||||||
|
print('OK')
|
||||||
|
else:
|
||||||
|
print('WAITING: rc={}, tg={}'.format(rc, tg))
|
||||||
|
except Exception as e:
|
||||||
|
print('ERROR: {}'.format(e))
|
||||||
|
" 2>/dev/null)
|
||||||
|
if [ "$state_check" = "OK" ]; then
|
||||||
|
verified=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $((i % 4)) -eq 0 ]; then
|
if [ $((i % 4)) -eq 0 ]; then
|
||||||
msg verify_timeout
|
msg verify_timeout
|
||||||
|
|||||||
Reference in New Issue
Block a user