You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/11/18 23:27:14 UTC

[GitHub] [airflow] XD-DENG commented on a diff in pull request #27775: [misc] Get rid of `pass` statement in conditions

XD-DENG commented on code in PR #27775:
URL: https://github.com/apache/airflow/pull/27775#discussion_r1026970944


##########
airflow/providers/ssh/hooks/ssh.py:
##########
@@ -290,17 +290,16 @@ def get_conn(self) -> paramiko.SSHClient:
             known_hosts = os.path.expanduser("~/.ssh/known_hosts")
             if not self.allow_host_key_change and os.path.isfile(known_hosts):
                 client.load_host_keys(known_hosts)
-        else:
-            if self.host_key is not None:
-                client_host_keys = client.get_host_keys()
-                if self.port == SSH_PORT:
-                    client_host_keys.add(self.remote_host, self.host_key.get_name(), self.host_key)
-                else:
-                    client_host_keys.add(
-                        f"[{self.remote_host}]:{self.port}", self.host_key.get_name(), self.host_key
-                    )
+
+        elif self.host_key is not None:
+            # Get host key from connection extra if it not set or None than we fallback to system host keys

Review Comment:
   ```suggestion
               # Get host key from connection extra if it not set or None then we fallback to system host keys
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org