adobe-ddavidso commented on code in PR #60953:
URL: https://github.com/apache/airflow/pull/60953#discussion_r3028879947


##########
providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py:
##########
@@ -179,7 +194,10 @@ def __init__(
         self.kv_engine_version = kv_engine_version or 2
         self.url = url
         self.auth_type = auth_type
-        self.kwargs = kwargs
+        # Filter out cache_approle_token from kwargs as it's specific to 
_VaultClient
+        # and not a valid hvac.Client parameter. This prevents unexpected 
keyword argument
+        # errors when instantiating the hvac client.
+        self.kwargs = {k: v for k, v in kwargs.items() if k != 
"cache_approle_token"}

Review Comment:
   The filtering is necessary. hvac.Client.__init__ does accept **kwargs, but 
it passes them directly to the adapter constructor 
([source](https://github.com/hvac/hvac/blob/main/hvac/v1/__init__.py)), and the 
Adapter class has explicit named parameters with no **kwargs to catch unknowns. 
Passing cache_approle_token through results in TypeError: __init__() got an 
unexpected keyword argument 'cache_approle_token', which I observed in testing. 
The filter is a one-liner and keeps our Airflow-specific param from leaking 
into the hvac instantiation.  



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