diff --git a/Controller/mysql_connect.py b/Controller/mysql_connect.py index e211665..df47a6e 100644 --- a/Controller/mysql_connect.py +++ b/Controller/mysql_connect.py @@ -6,15 +6,14 @@ import os def ping(host): # Führe den Ping-Befehl aus und erfasse die Ausgabe result = os.system("ping -c 1 " + host) - return result - -if ping("172.17.1.21") == 0: - hostname = "172.17.1.21, 22" -else: - hostname = "forward.stines.de, 2223" + if result == 0: + hostname = "172.17.1.21", 22 + else: + hostname = "forward.stines.de", 2223 + return hostname server = SSHTunnelForwarder( - (hostname), + (ping("172.17.1.21")), ssh_username="root", ssh_password="adm.3dfx12", remote_bind_address=('127.0.0.1', 3306)