From aec8d50a04187c4877146779fc4d72077fa8b739 Mon Sep 17 00:00:00 2001
From: Christian Boettcher <c.boettcher@fz-juelich.de>
Date: Mon, 13 Dec 2021 10:23:32 +0100
Subject: [PATCH] add some debug logging

---
 src/datacat_integration/secrets.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/datacat_integration/secrets.py b/src/datacat_integration/secrets.py
index 7a590cc..33d18a3 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
 
-- 
GitLab