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