uranusjr commented on a change in pull request #15964:
URL: https://github.com/apache/airflow/pull/15964#discussion_r636840511
##########
File path: airflow/providers/ssh/hooks/ssh.py
##########
@@ -218,7 +218,8 @@ def get_conn(self) -> paramiko.SSHClient:
else:
if self.host_key is not None:
client_host_keys = client.get_host_keys()
- client_host_keys.add(self.remote_host, 'ssh-rsa',
self.host_key)
+ remote_host = f"[{self.remote_host}]:{self.port}" if self.port
!= SSH_PORT else self.remote_host
+ client_host_keys.add(remote_host, 'ssh-rsa', self.host_key)
Review comment:
How about this?
```python
if self.port == SSH_PORT:
client_host_keys.add(self.remote_host, 'ssh-rsa', self.host_key)
if self.port:
client_host_keys.add(f"{self.remote_host}:{self.port}", 'ssh-rsa',
self.host_key)
```
So SSH servers exposed on the default port can have both registered.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]