uranusjr commented on a change in pull request #19164:
URL: https://github.com/apache/airflow/pull/19164#discussion_r735729920
##########
File path: airflow/providers/google/cloud/utils/credentials_provider.py
##########
@@ -202,20 +204,22 @@ def __init__(
self,
key_path: Optional[str] = None,
keyfile_dict: Optional[Dict[str, str]] = None,
+ key_secret_name: Optional[str] = None,
scopes: Optional[Collection[str]] = None,
delegate_to: Optional[str] = None,
disable_logging: bool = False,
target_principal: Optional[str] = None,
delegates: Optional[Sequence[str]] = None,
) -> None:
super().__init__()
- if key_path and keyfile_dict:
- raise AirflowException(
- "The `keyfile_dict` and `key_path` fields are mutually
exclusive. "
- "Please provide only one value."
+ key_options = [key_path, key_secret_name, keyfile_dict]
+ if len([x for x in key_options if x]) > 1:
+ raise AirflowException(f"The `keyfile_dict`, `key_path`, and
`key_secret_name` fields"
+ "are all mutually exclusive. Please provide only one value."
)
Review comment:
Use `bool()` instead of `is not None` if empty string is a concern (the
previous `is None` was a typo; sorry about that)
--
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]