feat: bootstrap ssh-monitor updater when missing on host (0.20.2)

SAC now clones the ssh-monitor repo and installs update_ssh_monitor.sh before running the update when the remote updater script is absent.
This commit is contained in:
2026-06-20 17:01:06 +10:00
parent 07b97bd111
commit c21043d845
5 changed files with 146 additions and 26 deletions
+8 -1
View File
@@ -4,6 +4,7 @@ from sqlalchemy import func, select
from sqlalchemy.orm import Session
from datetime import datetime, timezone
from functools import partial
from app.auth.jwt_auth import get_current_user, require_admin
from app.config import get_settings
@@ -412,7 +413,13 @@ def update_host_agent_via_ssh(
if not cfg.configured:
raise HTTPException(status_code=400, detail="Linux SSH admin is not configured")
response = _run_ssh_action_on_host(host, cfg, action=run_ssh_monitor_update)
agent_cfg = get_effective_agent_update_config(db)
repo_url = (agent_cfg.ssh_git_repo_url or "").strip() or None
response = _run_ssh_action_on_host(
host,
cfg,
action=partial(run_ssh_monitor_update, repo_url=repo_url),
)
_set_ssh_admin_status(host, response.ok)
if response.ok and response.product_version:
host.product_version = response.product_version