Fetch DW credentials and test.

This commit is contained in:
Pablo Martin 2023-01-16 13:57:34 +01:00
parent 3590bedffd
commit 2d9300c18e
2 changed files with 37 additions and 0 deletions

View file

@ -87,6 +87,7 @@ class LolaConfig:
self.ENV_DATA = None
self.TRINO_CREDENTIALS = None
self.SSH_TUNNEL_CREDENTIALS = None
self.DW_CREDENTIALS = None
self._s3_reader = S3FileReader(s3_client=boto3.client("s3"))
@ -138,6 +139,22 @@ class LolaConfig:
"ssh_jumphost": self.ENV_DATA["pt_ssh_jumphost"],
}
@_needs_env_data
def fetch_dw_credentials(self, s3_reader=None) -> None:
"""
Read the env file from S3 and store the DW credentials.
:param s3_reader: a client to fetch files from S3.
:return: None
"""
self.DW_CREDENTIALS = {
"host": self.ENV_DATA["datadw_host"],
"user": self.ENV_DATA["datadw_user"],
"password": self.ENV_DATA["datadw_pass"],
"port": self.ENV_DATA["datadw_port"],
}
def fetch_env_data(self, s3_reader=None) -> None:
"""
Read the env file from S3 with the default or a passed s3_reader and