Skip to content

Commit

Permalink
Fix AWS Connection warn condition for invalid profile_name argument (
Browse files Browse the repository at this point in the history
  • Loading branch information
Taragolis committed Sep 19, 2022
1 parent 4930df4 commit a2b186a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions airflow/providers/amazon/aws/utils/connection_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ def __post_init__(self, conn: Connection):
)

# Warn the user that an invalid parameter is being used which actually not related to 'profile_name'.
if "profile" in extra and "s3_config_file" not in extra:
if "profile_name" not in self.session_kwargs:
warnings.warn(
f"Found 'profile' without specifying 's3_config_file' in {self.conn_repr} extra. "
"If required profile from AWS Shared Credentials please "
f"set 'profile_name' in {self.conn_repr} extra['session_kwargs'].",
UserWarning,
stacklevel=2,
)
# ToDo: Remove this check entirely as soon as drop support credentials from s3_config_file
if "profile" in extra and "s3_config_file" not in extra and not self.profile_name:
warnings.warn(
f"Found 'profile' without specifying 's3_config_file' in {self.conn_repr} extra. "
"If required profile from AWS Shared Credentials please "
f"set 'profile_name' in {self.conn_repr} extra.",
UserWarning,
stacklevel=2,
)

config_kwargs = extra.get("config_kwargs")
if not self.botocore_config and config_kwargs:
Expand Down

0 comments on commit a2b186a

Please sign in to comment.