Skip to content

Commit

Permalink
using gateway automatically deactivates public ip usage now.
Browse files Browse the repository at this point in the history
  • Loading branch information
XaverStiensmeier committed Sep 18, 2023
1 parent a6a3b44 commit 4a458ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bibigrid/core/actions/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions bibigrid/core/utility/handler/ssh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4a458ca

Please sign in to comment.