airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] Gwildor commented on a change in pull request #3945: [AIRFLOW-3112] Make SFTP hook to inherit SSH hook
Date Tue, 23 Oct 2018 14:42:33 GMT
Gwildor commented on a change in pull request #3945: [AIRFLOW-3112] Make SFTP hook to inherit
SSH hook
URL: https://github.com/apache/incubator-airflow/pull/3945#discussion_r227425550
 
 

 ##########
 File path: airflow/contrib/hooks/sftp_hook.py
 ##########
 @@ -39,32 +42,66 @@ class SFTPHook(BaseHook):
     Errors that may occur throughout but should be handled downstream.
     """
 
-    def __init__(self, ftp_conn_id='sftp_default'):
-        self.ftp_conn_id = ftp_conn_id
+    def __init__(self, ftp_conn_id='sftp_default', *args, **kwargs):
+        kwargs['ssh_conn_id'] = ftp_conn_id
+        super(SFTPHook, self).__init__(*args, **kwargs)
+
         self.conn = None
+        self.private_key_pass = None
+
+        if self.ssh_conn_id is not None:
+            conn = self.get_connection(self.ssh_conn_id)
+            if conn.extra is not None:
+                extra_options = conn.extra_dejson
+                if 'private_key_pass' in extra_options:
+                    self.private_key_pass = extra_options.get('private_key_pass', None)
+
+                # For backward compatibility
+                # TODO: remove in Airflow 2.1
+                import warnings
+                if 'ignore_hostkey_verification' in extra_options \
+                        and str(extra_options["ignore_hostkey_verification"])\
+                        .lower() == 'false':
 
 Review comment:
   @ashb my PR is #4085

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message