Skip to content

Commit

Permalink
Extend port to rclone.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZiminski committed Apr 19, 2024
1 parent 3e09136 commit acbc58b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion datashuttle/utils/rclone.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from datashuttle.utils import utils
from datashuttle.utils.custom_types import TopLevelFolder

PORT = 3306 # TODO: direct copy!


def call_rclone(command: str, pipe_std: bool = False) -> CompletedProcess:
"""
Expand Down Expand Up @@ -99,7 +101,7 @@ def setup_rclone_config_for_ssh(
f"sftp "
f"host {cfg['central_host_id']} "
f"user {cfg['central_host_username']} "
f"port 22 "
f"port {PORT} "
f"key_file {ssh_key_path.as_posix()}",
pipe_std=True,
)
Expand Down
8 changes: 5 additions & 3 deletions datashuttle/utils/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import paramiko

PORT = 3306

from datashuttle.utils import utils

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -42,7 +44,7 @@ def connect_client_core(
else None
),
look_for_keys=True,
port=3306,
port=PORT,
)


Expand Down Expand Up @@ -84,7 +86,7 @@ def get_remote_server_key(central_host_id: str):
connection.
"""
transport: paramiko.Transport
with paramiko.Transport((central_host_id, 3306)) as transport:
with paramiko.Transport((central_host_id, PORT)) as transport:
transport.connect()
key = transport.get_remote_server_key()
return key
Expand All @@ -93,7 +95,7 @@ def get_remote_server_key(central_host_id: str):
def save_hostkey_locally(key, central_host_id, hostkeys_path) -> None:
client = paramiko.SSHClient()
client.get_host_keys().add(
f"[{central_host_id}]:3306", key.get_name(), key
f"[{central_host_id}]:{PORT}", key.get_name(), key
)
client.get_host_keys().save(hostkeys_path.as_posix())

Expand Down

0 comments on commit acbc58b

Please sign in to comment.