mik-laj commented on a change in pull request #15013:
URL: https://github.com/apache/airflow/pull/15013#discussion_r606649998



##########
File path: airflow/providers/hashicorp/secrets/vault.py
##########
@@ -188,12 +204,28 @@ def get_conn_uri(self, conn_id: str) -> Optional[str]:
         :rtype: str
         :return: The connection uri retrieved from the secret
         """
-        if self.connections_path is None:
+        response = self.get_response(conn_id)
+
+        return response.get("conn_uri") if response else None
+
+    def get_connection(self, conn_id: str) -> Optional['Connection']:
+        """
+        Get connection from Vault as secret. Prioritize conn_uri if exists,
+        if not fall back to normal Connection creation.
+
+        :type conn_id: str
+        :rtype: Connection
+        :return: A Connection object constructed from Vault data
+        """
+        response = self.get_response(conn_id)
+        if response is None:
             return None
-        else:
-            secret_path = self.build_path(self.connections_path, conn_id)
-            response = self.vault_client.get_secret(secret_path=secret_path)
-            return response.get("conn_uri") if response else None
+
+        uri = response.get("conn_uri")
+        if uri:
+            return uri
+
+        _create_connection(conn_id, response)

Review comment:
       I support this idea, but it can be a bit problematic now.
   See:  https://github.com/apache/airflow/pull/15013#discussion_r606649464




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to