mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 03:10: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
|
|
@ -10,6 +10,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 .cli_timeout import run_cli_with_timeout
|
||||
from .config import settings
|
||||
|
|
@ -228,6 +229,12 @@ def _sample_targets_shared_session(device_id: str, target_ids: list[str]) -> tup
|
|||
_set_target_error(tid, msg)
|
||||
return len(target_ids), msg
|
||||
|
||||
skip = cli_creds_skip_reason(creds, interactive=False)
|
||||
if skip:
|
||||
for tid in target_ids:
|
||||
_set_target_error(tid, skip)
|
||||
return len(target_ids), skip
|
||||
|
||||
vendor = str(info.get("vendor") or vendor_hint or "")
|
||||
device_type = str(info.get("device_type") or "")
|
||||
cmds = commands_for_vendor(vendor, device_type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue