ferruzzi commented on code in PR #27823:
URL: https://github.com/apache/airflow/pull/27823#discussion_r1028645709


##########
airflow/providers/amazon/aws/hooks/base_aws.py:
##########
@@ -405,9 +411,68 @@ def __init__(
         self.resource_type = resource_type
 
         self._region_name = region_name
-        self._config = config
+        self._config = config or botocore.config.Config()
         self._verify = verify
 
+    @classmethod
+    def _get_provider_version(cls) -> str:
+        """Checks the Providers Manager for the package version."""
+        manager = ProvidersManager()
+        provider_name = manager.hooks[cls.conn_type].package_name  # type: 
ignore[union-attr]

Review Comment:
   Or, following the precedent in `_get_caller`, since this should NEVER cause 
an issue to bubble up to the user, maybe this is better?
   
   ```
       @classmethod
       def _get_provider_version(cls) -> str:
           """Checks the Providers Manager for the package version."""
           try:
               manager = ProvidersManager()
               hook = manager.hooks[cls.conn_type]
               if not hook:
                   raise ValueError(f"Hook info for {cls.conn_type} not found 
in the Provider Manager.")
               provider = manager.providers[hook.package_name]
               return provider.version
           except Exception:
               # While it is generally considered poor form to catch 
"Exception", under
               # no condition should an error here ever cause an issue for the 
user.
               return "Unknown"
   ```            



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