diff --git a/src/datacat_integration/secrets.py b/src/datacat_integration/secrets.py index 7f389d0e0ef9da1a6ffbd4072fbe154feb125f49..7a590cc5029ef2599327c97411d00fbebbbef3b9 100644 --- a/src/datacat_integration/secrets.py +++ b/src/datacat_integration/secrets.py @@ -74,15 +74,19 @@ class DatacatSecretsBackend(BaseSecretsBackend): # TODO init with datacat elevated login to prevent secrets acces from jobs + def __init__(self, **kwargs): + super().__init__(**kwargs) + self.url = kwargs["url"] + self.user = kwargs["user"] + self.password = kwargs["password"] + 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 if conn_id != "860355e9-975f-4253-9421-1815e20c879b": return None - - hook = DataCatalogHook("datacatalog") - secrets_conn = DataCatConnectionWithSecrets(hook.connection.url, hook.connection.user, hook.connection._password) + secrets_conn = DataCatConnectionWithSecrets(self.url, self.user, self.password) data = secrets_conn.get_object(connection_backend_type, conn_id) secrets = secrets_conn.get_all_secret_key_value(connection_backend_type, conn_id) conn = get_connection_from_entry(data, secrets, connection_backend_type, conn_id)