Bart Eijk created AIRFLOW-4136:
----------------------------------

             Summary: SSHHook
                 Key: AIRFLOW-4136
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4136
             Project: Apache Airflow
          Issue Type: Wish
          Components: hooks
    Affects Versions: 1.10.2
            Reporter: Bart Eijk


When instantiating the SSHHook with a ssh_conn_id (with an empty 'extra-field) 
and key_file, the key_file argument is ignored because it is overwritten by 
None in the constructor of the SSHHook.

Code that is causing this behaviour is in the __init__ method of SSHHook (added 
comments for description of what actually happens)
{code}
            if conn.extra is not None:  # conn.extra is an empty string in our 
case: ''
                extra_options = conn.extra_dejson  # returns an empty dict
                self.key_file = extra_options.get("key_file")  # sets 
self.key_file to None, overriding user-provided key_file
{code}
A fix could either be to check if conn.extra is not None or not '' or to wrap 
the setting of the key_file with:
{code}
if "key_file" in extra_options:
{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to