ashb 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_r220305248
##########
File path: airflow/contrib/hooks/sftp_hook.py
##########
@@ -40,42 +43,47 @@ class SFTPHook(BaseHook):
"""
def __init__(self, ftp_conn_id='sftp_default'):
- self.ftp_conn_id = ftp_conn_id
- self.conn = None
+ super(SFTPHook, self).__init__(ftp_conn_id)
+
+ 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
+ self.private_key_pass = extra_options.get('private_key_pass',
None)
def get_conn(self):
"""
Returns an SFTP connection object
"""
- if self.conn is None:
- params = self.get_connection(self.ftp_conn_id)
+ if self.client is None:
cnopts = pysftp.CnOpts()
- if ('ignore_hostkey_verification' in params.extra_dejson and
- params.extra_dejson['ignore_hostkey_verification']):
+ if self.no_host_key_check:
Review comment:
Back-compat: `ignore_hostkey_verification` in extra_dejson not respected
anymore
----------------------------------------------------------------
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