diff --git a/src/datacat_integration/secrets.py b/src/datacat_integration/secrets.py index 7a590cc5029ef2599327c97411d00fbebbbef3b9..33d18a3c63ef4b2f076fb85a7025ae618a0ad311 100644 --- a/src/datacat_integration/secrets.py +++ b/src/datacat_integration/secrets.py @@ -3,12 +3,15 @@ from urllib.parse import urljoin from airflow.secrets import BaseSecretsBackend from airflow.models.connection import Connection import requests +import logging from datacat_integration.connection import DataCatConnection -from datacat_integration.hooks import DataCatalogHook, get_connection_from_entry +from datacat_integration.hooks import get_connection_from_entry connection_backend_type = "airflow_connections" +log = logging.getLogger(__name__) + def get_connection_with_secrets_from_entry(data: Dict[str, Any], secrets: Dict[str, str] , datacat_type: str, oid: str) -> Connection: """returns an aiflow connection from the data provided in the datacat entry and the secrets.""" @@ -72,9 +75,8 @@ class DataCatConnectionWithSecrets(DataCatConnection): class DatacatSecretsBackend(BaseSecretsBackend): """A Backend for directly managing connections in apache airflow""" - # TODO init with datacat elevated login to prevent secrets acces from jobs - def __init__(self, **kwargs): + log.debug("Init of Datacat Secrets Backend") super().__init__(**kwargs) self.url = kwargs["url"] self.user = kwargs["user"] @@ -83,6 +85,7 @@ class DatacatSecretsBackend(BaseSecretsBackend): def get_connection(self, conn_id: str): """returns a Connection object created from the <conenction_type>/<conn_id> object in the datacatalog""" # only for testing: check that a specific oid has been requested + log.debug(f"Get connection: {conn_id}") if conn_id != "860355e9-975f-4253-9421-1815e20c879b": return None