refactor(hosts): remove legacy host_agent redirects/paths (no back-compat)
Dev-only instance, no bookmarks — per family rule 22, fully remove old paths instead of shimming them. - Delete the /plugins/host_agent/ (index) and /plugins/host_agent/settings/ redirect routes; delete the now-dead host_list.html fleet template. - Move the remaining management POST routes off /settings/ to /fleet/ (add-host, rotate-token, delete) — single canonical prefix. - Repoint real callers to canonical URLs: dashboard widgets (host resources → /hosts/, history → /plugins/host_agent/fleet/), the full-metrics page breadcrumb + back link (→ the host hub), Settings→Ansible link, and the agent panel's curl-install link. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -372,14 +372,6 @@ async def _fleet_rows(session) -> list[dict]:
|
||||
return rows
|
||||
|
||||
|
||||
@host_agent_bp.get("/")
|
||||
@require_role(UserRole.viewer)
|
||||
async def index():
|
||||
"""The fleet view folded into the Hosts hub — kept as a redirect so old
|
||||
links/widgets don't 404."""
|
||||
return redirect("/hosts/")
|
||||
|
||||
|
||||
@host_agent_bp.get("/widget")
|
||||
async def widget_table():
|
||||
"""Fleet-glance dashboard widget: one row per monitored host, latest metrics."""
|
||||
@@ -568,13 +560,6 @@ async def host_panel(host_id: str):
|
||||
)
|
||||
|
||||
|
||||
@host_agent_bp.get("/settings/")
|
||||
@require_role(UserRole.admin)
|
||||
async def settings_redirect():
|
||||
"""Old management URL — agent management moved into the Hosts section."""
|
||||
return redirect(url_for("host_agent.fleet"))
|
||||
|
||||
|
||||
@host_agent_bp.get("/fleet/")
|
||||
@require_role(UserRole.admin)
|
||||
async def fleet():
|
||||
@@ -618,7 +603,7 @@ async def fleet():
|
||||
)
|
||||
|
||||
|
||||
@host_agent_bp.post("/settings/add-host")
|
||||
@host_agent_bp.post("/fleet/add-host")
|
||||
@require_role(UserRole.admin)
|
||||
async def add_host():
|
||||
form = await request.form
|
||||
@@ -650,7 +635,7 @@ async def add_host():
|
||||
return redirect(url_for("host_agent.fleet") + f"?new_token={raw}&host_id={host_id}")
|
||||
|
||||
|
||||
@host_agent_bp.post("/settings/<host_id>/rotate-token")
|
||||
@host_agent_bp.post("/fleet/<host_id>/rotate-token")
|
||||
@require_role(UserRole.admin)
|
||||
async def rotate_token(host_id: str):
|
||||
async with current_app.db_sessionmaker() as session:
|
||||
@@ -666,7 +651,7 @@ async def rotate_token(host_id: str):
|
||||
return redirect(url_for("host_agent.fleet") + f"?new_token={raw}&host_id={host_id}")
|
||||
|
||||
|
||||
@host_agent_bp.post("/settings/<host_id>/delete")
|
||||
@host_agent_bp.post("/fleet/<host_id>/delete")
|
||||
@require_role(UserRole.admin)
|
||||
async def delete_registration(host_id: str):
|
||||
async with current_app.db_sessionmaker() as session:
|
||||
|
||||
Reference in New Issue
Block a user