Skip to content

Add port conn params #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add port to connection parameters
  • Loading branch information
vshepard committed Jun 6, 2024
commit e8f4da9f63ac2681d7a10996a3eea625378aea6c
3 changes: 2 additions & 1 deletion testgres/operations/os_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@


class ConnectionParams:
def __init__(self, host='127.0.0.1', ssh_key=None, username=None):
def __init__(self, host='127.0.0.1', port=None, ssh_key=None, username=None):
self.host = host
self.port = port
self.ssh_key = ssh_key
self.username = username

Expand Down
3 changes: 3 additions & 0 deletions testgres/operations/remote_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ def __init__(self, conn_params: ConnectionParams):
self.conn_params = conn_params
self.host = conn_params.host
self.ssh_key = conn_params.ssh_key
self.port = conn_params.port
if self.ssh_key:
self.ssh_cmd = ["-i", self.ssh_key]
else:
self.ssh_cmd = []
if self.port:
self.ssh_cmd = ["-p", self.port]
self.remote = True
self.username = conn_params.username or self.get_user()
self.add_known_host(self.host)
Expand Down