From 3488ec12a6da0c5b7f92370a4a07be15d5286613 Mon Sep 17 00:00:00 2001 From: malmert Date: Mon, 24 Nov 2025 17:52:24 +0100 Subject: [PATCH] refactor: remove netplan apply endpoint and related code --- backend/src/main.py | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/backend/src/main.py b/backend/src/main.py index fcea009..730379e 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -60,35 +60,3 @@ def nft_ruleset(): # --------------------- app.include_router(network_api.router, prefix="/network", tags=["network"]) - - -# --------------------- -# Netplan Apply -# --------------------- - -NETPLAN_FILE = "/etc/netplan/99-app.yaml" - -@app.post("/netplan/apply") -def apply_netplan(config: netplan.NetworkConfig): - try: - data = {"network": config.dict(exclude_none=True)} - - with open(NETPLAN_FILE, "w") as f: - yaml.dump(data, f, sort_keys=False) - - result = subprocess.run( - ["netplan", "try", "--timeout", "10"], - capture_output=True, - text=True, - ) - - if result.returncode != 0: - raise HTTPException( - status_code=500, - detail=f"Netplan failed: {result.stderr}" - ) - - return {"status": "ok", "output": result.stdout} - - except Exception as e: - raise HTTPException(status_code=500, detail=str(e))