mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-06-14 10:14:46 +02:00
web: clarify docker restart update messaging
This commit is contained in:
@@ -83,6 +83,15 @@ def _schedule_container_exit(delay_seconds: float = _CONTAINER_RESTART_DELAY_SEC
|
||||
threading.Thread(target=_exit_process, name="container-restart-exit", daemon=True).start()
|
||||
|
||||
|
||||
def get_container_restart_message() -> str:
|
||||
"""Return the user-facing restart message for containerized installs."""
|
||||
return (
|
||||
"Container restart initiated. "
|
||||
"If you are running pyMC Repeater via Docker or Home Assistant, pull or rebuild "
|
||||
"a newer image for packaged image updates to take effect."
|
||||
)
|
||||
|
||||
|
||||
def restart_service() -> Tuple[bool, str]:
|
||||
"""
|
||||
Restart the pymc-repeater service.
|
||||
@@ -98,7 +107,7 @@ def restart_service() -> Tuple[bool, str]:
|
||||
if is_container():
|
||||
_schedule_container_exit()
|
||||
logger.info("Container environment detected; scheduled process exit for container restart")
|
||||
return True, "Container restart initiated"
|
||||
return True, get_container_restart_message()
|
||||
|
||||
if is_buildroot():
|
||||
if not os.path.exists(INIT_SCRIPT):
|
||||
|
||||
@@ -29,7 +29,7 @@ from datetime import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
import cherrypy
|
||||
from repeater.service_utils import is_buildroot
|
||||
from repeater.service_utils import get_container_restart_message, is_buildroot, is_container
|
||||
|
||||
logger = logging.getLogger("HTTPServer")
|
||||
|
||||
@@ -891,7 +891,13 @@ def _do_install() -> None:
|
||||
restart_msg = str(exc)
|
||||
logger.warning(f"[Update] Could not restart service: {exc}")
|
||||
if restart_ok:
|
||||
_state.finish_install(True, f"Upgraded to latest on channel '{channel}' – service restarted")
|
||||
if is_container():
|
||||
_state.finish_install(
|
||||
True,
|
||||
f"Upgraded to latest on channel '{channel}' – {get_container_restart_message()}",
|
||||
)
|
||||
else:
|
||||
_state.finish_install(True, f"Upgraded to latest on channel '{channel}' – service restarted")
|
||||
else:
|
||||
_state.finish_install(False, f"Upgrade succeeded but service restart failed: {restart_msg}")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user