You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/12/16 21:57:10 UTC

[GitHub] [airflow] ashb commented on a change in pull request #20353: Fix mypy in providers/aws/hooks

ashb commented on a change in pull request #20353:
URL: https://github.com/apache/airflow/pull/20353#discussion_r770947943



##########
File path: airflow/providers/amazon/aws/hooks/base_aws.py
##########
@@ -129,30 +130,30 @@ def _create_session_with_assume_role(self, session_kwargs: Dict[str, Any]) -> bo
             )
         session = botocore.session.get_session()
         session._credentials = credentials
+
         if self.basic_session is None:
             raise RuntimeError("The basic session should be created here!")
+
         region_name = self.basic_session.region_name
         session.set_config_variable("region", region_name)
+
         return boto3.session.Session(botocore_session=session, **session_kwargs)
 
     def _refresh_credentials(self) -> Dict[str, Any]:
         self.log.info('Refreshing credentials')
         assume_role_method = self.extra_config.get('assume_role_method', 'assume_role')
         sts_session = self.basic_session
+
+        if sts_session is None:

Review comment:
       We can create a basic_session with no extra arguments.
   
   How about changing it so that basic_session is a "create+fash on first use" property?




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org