[ https://issues.apache.org/jira/browse/AIRFLOW-4136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fokko Driesprong updated AIRFLOW-4136: -------------------------------------- Summary: Fix overwrite of key_file by constructor in SSHHook (was: SSHHook) > Fix overwrite of key_file by constructor in 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 > Priority: Minor > Fix For: 2.0.0 > > > 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)