diff --git a/alibabacloud_credentials/__init__.py b/alibabacloud_credentials/__init__.py index 8d33675..b71b329 100644 --- a/alibabacloud_credentials/__init__.py +++ b/alibabacloud_credentials/__init__.py @@ -1 +1 @@ -__version__ = "1.0.5" +__version__ = "1.0.6" diff --git a/alibabacloud_credentials/provider/cli_profile.py b/alibabacloud_credentials/provider/cli_profile.py index b7c52af..e04cef4 100644 --- a/alibabacloud_credentials/provider/cli_profile.py +++ b/alibabacloud_credentials/provider/cli_profile.py @@ -248,8 +248,10 @@ def _find_source_oauth_profile(config: dict, profile_name: str) -> dict: if profile.get('mode') == 'OAuth': return profile - elif source_profile := profile.get('source_profile'): - return _find_source_oauth_profile(config, source_profile) + else: + source_profile = profile.get('source_profile') + if source_profile: + return _find_source_oauth_profile(config, source_profile) raise CredentialException(f"unable to get OAuth profile with name '{profile_name}' from cli credentials file.") @@ -563,8 +565,10 @@ def _find_source_oauth_profile(config: dict, profile_name: str) -> dict: if profile.get('mode') == 'OAuth': return profile - elif source_profile := profile.get('source_profile'): - return _find_source_oauth_profile(config, source_profile) + else: + source_profile = profile.get('source_profile') + if source_profile: + return _find_source_oauth_profile(config, source_profile) raise CredentialException(f"unable to get OAuth profile with name '{profile_name}' from cli credentials file.")