mirror of
https://github.com/hansjone/netx.git
synced 2026-10-10 11:03:15 +08:00
feat(ops): add managed NE management and batch CLI collection
Introduce workbench operations for multi-vendor NE CRUD/connect-test and Netmiko batch collection with job lifecycle controls, log downloads, and paginated run filters. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
282dbe75af
commit
042c015045
36 changed files with 3695 additions and 17 deletions
26
netx_api/ne_collection_paths.py
Normal file
26
netx_api/ne_collection_paths.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from .config import settings
|
||||
|
||||
|
||||
def collection_data_root() -> Path:
|
||||
root = Path(str(settings.ne_collection_data_dir or "data/ne_collections"))
|
||||
root.mkdir(parents=True, exist_ok=True)
|
||||
return root.resolve()
|
||||
|
||||
|
||||
def run_output_dir(job_id: str, run_id: str) -> Path:
|
||||
return collection_data_root() / job_id / run_id
|
||||
|
||||
|
||||
def clear_run_output_files(job_id: str, run_id: str) -> None:
|
||||
"""Remove prior log files for this run so re-collection overwrites in place."""
|
||||
out_dir = run_output_dir(job_id, run_id).resolve()
|
||||
root = collection_data_root()
|
||||
if not str(out_dir).startswith(str(root)) or not out_dir.is_dir():
|
||||
return
|
||||
for path in out_dir.iterdir():
|
||||
if path.is_file():
|
||||
path.unlink(missing_ok=True)
|
||||
Loading…
Add table
Add a link
Reference in a new issue