From 47730521bcd8c50c91f07046967549a4dd07232c Mon Sep 17 00:00:00 2001 From: "info@pi-farm.de" Date: Tue, 3 Mar 2026 22:55:38 +0000 Subject: [PATCH] main.py aktualisiert --- main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.py b/main.py index 5dad282..d713ce0 100644 --- a/main.py +++ b/main.py @@ -100,6 +100,14 @@ async def remove_node(node_id: int): conn.close() return RedirectResponse(url="/", status_code=303) +async def check_docker_installed(ip, user): + # Prüft via SSH, ob der Befehl 'docker' existiert + cmd = "command -v docker >/dev/null 2>&1 && echo 'yes' || echo 'no'" + ssh_cmd = f"ssh -o StrictHostKeyChecking=no {user}@{ip} '{cmd}'" + process = subprocess.Popen(ssh_cmd, shell=True, stdout=subprocess.PIPE, text=True) + output = process.stdout.read().strip() + return output == "yes" + # --- Chat & KI Logik --- @app.websocket("/ws/chat")