uranusjr commented on a change in pull request #19164:
URL: https://github.com/apache/airflow/pull/19164#discussion_r736119651
##########
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:
Sorry I was probably not clear about the suggestion. False is when I
want the exception to be raised. This leaves `True ^ True ^ True` as a special
case, where we can catch separately.
But thisking about this again, that entire expression is probably too
complex to understand, so this is better.
--
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]