ckljohn 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_r227436616
##########
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:
Thanks.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services