diff --git a/bibigrid/core/actions/create.py b/bibigrid/core/actions/create.py index 66093f1f..b0db9abd 100644 --- a/bibigrid/core/actions/create.py +++ b/bibigrid/core/actions/create.py @@ -91,7 +91,8 @@ def __init__(self, providers, configurations, config_path, log, debug=False, clu self.worker_counter = 0 self.vpn_counter = 0 self.thread_lock = threading.Lock() - self.use_master_with_public_ip = configurations[0].get("useMasterWithPublicIp", True) + self.use_master_with_public_ip = not configurations[0].get("gateway") and configurations[0].get( + "useMasterWithPublicIp", True) self.log.debug("Keyname: %s", self.key_name) def generate_keypair(self): diff --git a/bibigrid/core/utility/handler/ssh_handler.py b/bibigrid/core/utility/handler/ssh_handler.py index 90102690..0067a2bb 100644 --- a/bibigrid/core/utility/handler/ssh_handler.py +++ b/bibigrid/core/utility/handler/ssh_handler.py @@ -108,10 +108,10 @@ def is_active(client, floating_ip_address, private_key, username, log, gateway, port = 22 if gateway: log.info(f"Using SSH Gateway {gateway.get('ip')}") - octets = {f'oct{enum+1}': int(elem) for enum, elem in floating_ip_address.split(".")} + octets = {f'oct{enum+1}': int(elem) for enum, elem in enumerate(floating_ip_address.split("."))} port = sympy.sympify(gateway["portFunction"]).subs(dict(octets)) client.connect(hostname=gateway.get("ip") or floating_ip_address, username=username, - pkey=private_key, timeout=7, auth_timeout=5, port=port) + pkey=private_key, timeout=7, auth_timeout=5, port=int(port)) establishing_connection = False log.info(f"Successfully connected to {floating_ip_address}") except paramiko.ssh_exception.NoValidConnectionsError as exc: