potiuk opened a new issue, #73584:
URL: https://github.com/apache/airflow/issues/73584
`SFTPHookAsync._parse_extras()` decides whether to take `known_hosts` from
the connection extras with:
```python
if "known_hosts" in extra_options and self.known_hosts !=
self.default_known_hosts:
self.known_hosts = extra_options["known_hosts"]
```
`self.known_hosts` has already been through `os.path.expanduser()` in
`__init__`, while `default_known_hosts` is the literal `"~/.ssh/known_hosts"`.
The two never compare equal, so the condition is always true whenever the extra
is present: a connection-level `known_hosts` overrides even a path passed
explicitly to the constructor. `SSHHookAsync` gets this right — it compares
against the expanded default and only falls back to the extra when the
constructor left the default in place.
**Expected:** an explicit constructor path wins; the extra applies only when
the constructor used the default — consistent with `SSHHookAsync`.
**Regression test:** construct
`SFTPHookAsync(known_hosts="/explicit/known_hosts")`, parse a connection with
`{"known_hosts": "/connection/known_hosts"}`, and assert
`/explicit/known_hosts` is kept.
Pre-existing; surfaced during review of #73419 and deliberately left out of
that PR's scope.
---
Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
--
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]