BasPH commented on code in PR #59224:
URL: https://github.com/apache/airflow/pull/59224#discussion_r2634134095


##########
providers/hashicorp/src/airflow/providers/hashicorp/secrets/vault.py:
##########
@@ -199,14 +199,15 @@ def get_connection(self, conn_id: str) -> Connection | 
None:
         from airflow.models.connection import Connection
 
         response = self.get_response(conn_id)
-        if response is None:
+        if not response:
             return None
-
-        uri = response.get("conn_uri")
-        if uri:
+        try:
+            uri = response["conn_uri"]
             return Connection(conn_id, uri=uri)
-
-        return Connection(conn_id, **response)
+        except KeyError:
+            self.log.warning('Vault connection %s fetched but does not have 
required key "conn_uri"', conn_id)

Review Comment:
   On second thought, this is not the behaviour we want for fetching 
connections. While variables and configs can only be set via one key `value`, 
connections can be set in two ways: `conn_uri` or the [json-representation 
keys](https://airflow.apache.org/docs/apache-airflow/3.1.5/howto/connection.html#generating-a-json-connection-representation)
 (`host`, `login`, etc.). This code would therefore introduce an (undesirable) 
warning.
   
   I suggest we remove the changes for `get_connection`.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to