mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 05:30:46 +08:00
Skip CLI startup when device credentials are incomplete.
Reject non-interactive CLI work early across exec, LLDP, config sync, collection, traffic, and connect-test flows so tasks record a clear reason instead of launching a doomed session. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
dcdf4147a6
commit
b6a579ec02
12 changed files with 317 additions and 31 deletions
|
|
@ -13,6 +13,7 @@ from uuid import uuid4
|
|||
|
||||
from fastapi import HTTPException
|
||||
|
||||
from .cli_creds import cli_creds_skip_reason
|
||||
from .cli_resolve import resolve_cli_target
|
||||
from .config import settings
|
||||
from .config_sync_codec import compress_text
|
||||
|
|
@ -318,6 +319,19 @@ def _run_single(cycle_id: str, task_id: str) -> None:
|
|||
_update_task(task_id, status="fail", message=_format_error(exc), ended_at=_utcnow())
|
||||
return
|
||||
|
||||
skip = cli_creds_skip_reason(creds, interactive=False)
|
||||
if skip:
|
||||
_update_task(
|
||||
task_id,
|
||||
status="fail",
|
||||
message=skip[:1020],
|
||||
vendor=str(device.get("vendor") or vendor_hint or ""),
|
||||
ne_name=str(device.get("name") or task.ne_name or ""),
|
||||
ne_ip=str(device.get("ip_address") or task.ne_ip or ""),
|
||||
ended_at=_utcnow(),
|
||||
)
|
||||
return
|
||||
|
||||
vendor = str(device.get("vendor") or vendor_hint or "")
|
||||
device_type = str(device.get("device_type") or "")
|
||||
ne_name = str(device.get("name") or task.ne_name or "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue