sh2/d2ypp2/tools/debug_host03_web_import.py
eric 278b48497e Add YouTube relay log tooling and optional hub service controls.
This captures the current live stack updates across the API, Linux service scripts, tests, diagnostics, and exported console assets so the Ubuntu deployment can pull a consistent test3 build.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 05:10:09 -05:00

35 lines
1.1 KiB
Python

#!/usr/bin/env python3
from __future__ import annotations
import sys
import paramiko
HOST, USER, PASS = "10.88.0.3", "eric", "Xiao4669805"
BASE = "/opt/live/d2ypp"
def run(cmd: str, timeout: int = 120) -> str:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, username=USER, password=PASS, timeout=20)
_, o, e = c.exec_command("export LC_ALL=C.UTF-8 LANG=C.UTF-8; " + cmd, timeout=timeout)
out = (o.read() + e.read()).decode("utf-8", "replace")
c.close()
return out
def safe_print(text: str) -> None:
try:
print(text)
except UnicodeEncodeError:
sys.stdout.buffer.write(text.encode("utf-8", errors="replace") + b"\n")
cmds = [
f"journalctl -u live-console.service -n 60 --no-pager 2>&1 | tail -40",
f"cd {BASE} && .venv/bin/python -c \"import web; print('web_import_ok')\" 2>&1",
f"cd {BASE} && .venv/bin/python -c \"from src.youtube_relay_log import list_relay_sessions; print(list_relay_sessions(limit=1))\" 2>&1",
]
for cmd in cmds:
safe_print(f"\n=== {cmd[:80]} ===\n{run(cmd)[:4000]}")