fix: ansible routes validation, SSE dedup, scoped querySelector, status_color fallback
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# fablednetmon/ansible/routes.py
|
||||
from __future__ import annotations
|
||||
import asyncio
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
@@ -77,6 +78,9 @@ async def create_run():
|
||||
source_name = form.get("source_name", "").strip()
|
||||
inventory_path = form.get("inventory_path", "").strip()
|
||||
|
||||
if not playbook_path or not inventory_path:
|
||||
return "playbook_path and inventory_path are required", 400
|
||||
|
||||
all_sources = _get_sources()
|
||||
source = next((s for s in all_sources if s["name"] == source_name), None)
|
||||
if source is None:
|
||||
@@ -98,8 +102,7 @@ async def create_run():
|
||||
async with db.begin():
|
||||
db.add(run)
|
||||
|
||||
import asyncio
|
||||
asyncio.create_task(
|
||||
task = asyncio.create_task(
|
||||
executor.start_run(
|
||||
current_app._get_current_object(), # type: ignore[attr-defined]
|
||||
run_id,
|
||||
@@ -108,6 +111,11 @@ async def create_run():
|
||||
source["path"],
|
||||
)
|
||||
)
|
||||
task.add_done_callback(
|
||||
lambda t: t.exception() and current_app.logger.error(
|
||||
"Ansible run %s raised: %s", run_id, t.exception()
|
||||
)
|
||||
)
|
||||
|
||||
return await render_template(
|
||||
"ansible/run_started.html",
|
||||
|
||||
Reference in New Issue
Block a user