Fetch SSH tunnel creds and test
This commit is contained in:
parent
503c70fa02
commit
592dd6bb69
2 changed files with 45 additions and 0 deletions
|
|
@ -69,6 +69,7 @@ class LolaConfig:
|
|||
)
|
||||
|
||||
self.TRINO_CREDENTIALS = None
|
||||
self.SSH_TUNNEL_CREDENTIALS = None
|
||||
|
||||
self._s3_reader = S3FileReader(s3_client=boto3.client("s3"))
|
||||
|
||||
|
|
@ -109,6 +110,29 @@ class LolaConfig:
|
|||
"port": env_data["trino_port"],
|
||||
}
|
||||
|
||||
def fetch_ssh_tunnel_credentials(self, s3_reader=None) -> None:
|
||||
"""
|
||||
Read the env file from S3 and store the SSH tunnel credentials.
|
||||
|
||||
:param s3_reader: a client to fetch files from S3.
|
||||
:return: None
|
||||
"""
|
||||
|
||||
if s3_reader is None:
|
||||
s3_reader = self._s3_reader
|
||||
|
||||
env_data = s3_reader.read_json_from_s3_file(
|
||||
bucket=self.S3_BUCKET_NAME, key=self.ENV_FILE_PATH
|
||||
)
|
||||
|
||||
self.SSH_TUNNEL_CREDENTIALS = {
|
||||
"path_to_ssh_pkey": env_data["pt_ssh_pkey_path"],
|
||||
"ssh_pkey_password": env_data["pt_ssh_pkey_passphrase"],
|
||||
"ssh_username": env_data["pt_ssh_username"],
|
||||
"ssh_port": env_data["pt_ssh_jumphost_port"],
|
||||
"ssh_jumphost": env_data["pt_ssh_jumphost"],
|
||||
}
|
||||
|
||||
|
||||
def build_lolaconfig(
|
||||
flow_name: str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue