fix: fix opening shell
When opening a shell, the host address was hardcoded into localhost.
Now, fix it to use the host address of the shell container.
@@ -71,13 +71,15 @@ def open_shell(args: Namespace) -> None:
def _open_shell(shell: Command, username: str, additional_opts: str) -> None:
+ LOOPBACK_ADDRESS = "[::1]"
with tempfile.NamedTemporaryFile("w") as fp:
fp.write(shell.misc["privateKey"])
fp.flush()
check_len(shell.addresses, 1, "Cannot find address for shell")
-
- _, port = shell.addresses[0]["host_ip"], shell.addresses[0]["host_port"]
+ host, port = shell.addresses[0]["host_ip"], shell.addresses[0]["host_port"]
+ if host == LOOPBACK_ADDRESS:
host = "localhost"
+
os.system(
"ssh -o StrictHostKeyChecking=no -tt -o IdentitiesOnly=yes -i {} -p {} {} {}@{}".format(
fp.name, port, additional_opts, username, host
