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))