dabla commented on code in PR #64643:
URL: https://github.com/apache/airflow/pull/64643#discussion_r3489993691
##########
providers/samba/src/airflow/providers/samba/hooks/samba.py:
##########
@@ -43,29 +43,59 @@ class SambaHook(BaseHook):
the connection is used in its place.
:param share_type:
An optional share type name. If this is unset then it will assume a
posix share type.
+ :param auth_protocol:
+ An optional authentication protocol. If this is unset then it defaults
to negotiate.
"""
conn_name_attr = "samba_conn_id"
default_conn_name = "samba_default"
conn_type = "samba"
hook_name = "Samba"
+ VALID_AUTH_PROTOCOLS = {"negotiate", "ntlm", "kerberos"}
+
def __init__(
self,
samba_conn_id: str = default_conn_name,
share: str | None = None,
share_type: Literal["posix", "windows"] | None = None,
+ auth_protocol: Literal["negotiate", "ntlm", "kerberos"] | None = None,
) -> None:
super().__init__()
conn = self.get_connection(samba_conn_id)
+ extra = conn.extra_dejson
+
+ legacy_auth = extra.get("auth")
+ legacy_auth_protocol = (
Review Comment:
Could this not be rewritten as follow?
```
legacy_auth_protocol = (
legacy_auth if isinstance(legacy_auth, str) and legacy_auth in
self.VALID_AUTH_PROTOCOLS else "negotiate"
)
self._auth_protocol: str = (
auth_protocol or extra.get("auth_protocol", legacy_auth_protocol)
)
```
--
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]