Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions ddpui/core/warehousefunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def get_warehouse_data(request, data_type: str, **kwargs):
order_by=kwargs["order_by"],
order=kwargs["order"],
)
except ValueError as error:
logger.error(f"Warehouse configuration error in get_{data_type}: {error}")
raise HttpError(400, str(error))
except Exception as error:
logger.exception(f"Exception occurred in get_{data_type}: {error}")
raise HttpError(500, f"Failed to get {data_type}")
Expand Down
19 changes: 16 additions & 3 deletions ddpui/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,30 @@ def map_airbyte_keys_to_postgres_keys(conn_info: dict):
"""called by `post_system_transformation_tasks` and `_get_wclient`"""
if "tunnel_method" in conn_info:
method = conn_info["tunnel_method"]
tunnel_type = method.get("tunnel_method")

if method["tunnel_method"] in ["SSH_KEY_AUTH", "SSH_PASSWORD_AUTH"]:
if tunnel_type in ["SSH_KEY_AUTH", "SSH_PASSWORD_AUTH"]:
missing = [
k for k in ["tunnel_host", "tunnel_port", "tunnel_user"]
if k not in method
]
if missing:
raise ValueError(
f"SSH tunnel config is missing required fields: {', '.join(missing)}"
)
conn_info["ssh_host"] = method["tunnel_host"]
conn_info["ssh_port"] = method["tunnel_port"]
conn_info["ssh_username"] = method["tunnel_user"]

if method["tunnel_method"] == "SSH_KEY_AUTH":
if tunnel_type == "SSH_KEY_AUTH":
if "ssh_key" not in method:
raise ValueError(
"SSH tunnel config is missing required field: ssh_key"
)
conn_info["ssh_pkey"] = method["ssh_key"]
conn_info["ssh_private_key_password"] = method.get("tunnel_private_key_password")

elif method["tunnel_method"] == "SSH_PASSWORD_AUTH":
elif tunnel_type == "SSH_PASSWORD_AUTH":
conn_info["ssh_password"] = method.get("tunnel_user_password")

conn_info["user"] = conn_info["username"]
Expand Down
Loading