You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/05/06 17:33:05 UTC

[GitHub] [airflow] eepstein commented on a change in pull request #5135: [AIRFLOW-4465] ssh_operator: pass remote_host via ssh_hook constructor

eepstein commented on a change in pull request #5135: [AIRFLOW-4465] ssh_operator: pass remote_host via ssh_hook constructor
URL: https://github.com/apache/airflow/pull/5135#discussion_r281282160
 
 

 ##########
 File path: airflow/contrib/operators/ssh_operator.py
 ##########
 @@ -71,11 +71,19 @@ def execute(self, context):
             if self.ssh_conn_id:
                 if self.ssh_hook and isinstance(self.ssh_hook, SSHHook):
                     self.log.info("ssh_conn_id is ignored when ssh_hook is provided.")
+                    
+                if self.remote_host is not None:
+                    self.ssh_hook.remote_host = self.remote_host
 
 Review comment:
   Not so.  This is a feature of ssh_operator that allows re-using an SSHHook (for example, across operators) and dynamically setting the remote_host.  It does have some risk in a multi-threaded execution, so... user beware.  
   That said, the indentation was incorrect.  The condition applies IFF ssh_hook is defined on the ssh_operator instance.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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