Skip to content

Commit

Permalink
[AIRFLOW-2245] Add remote_host of SSH/SFTP operator as templated field (
Browse files Browse the repository at this point in the history
#3765)

It allows remote_host to be passed to operator with XCOM.
  • Loading branch information
ckljohn authored and kaxil committed Jan 9, 2019
1 parent bb570fd commit 304f09a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions airflow/contrib/operators/sftp_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SFTPOperator(BaseOperator):
:type ssh_hook: :class:`SSHHook`
:param ssh_conn_id: connection id from airflow Connections
:type ssh_conn_id: str
:param remote_host: remote host to connect
:param remote_host: remote host to connect (templated)
:type remote_host: str
:param local_filepath: local file path to get or put. (templated)
:type local_filepath: str
Expand All @@ -48,7 +48,7 @@ class SFTPOperator(BaseOperator):
:param confirm: specify if the SFTP operation should be confirmed, defaults to True
:type confirm: bool
"""
template_fields = ('local_filepath', 'remote_filepath')
template_fields = ('local_filepath', 'remote_filepath', 'remote_host')

@apply_defaults
def __init__(self,
Expand Down
4 changes: 2 additions & 2 deletions airflow/contrib/operators/ssh_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SSHOperator(BaseOperator):
:type ssh_hook: :class:`SSHHook`
:param ssh_conn_id: connection id from airflow Connections
:type ssh_conn_id: str
:param remote_host: remote host to connect
:param remote_host: remote host to connect (templated)
:type remote_host: str
:param command: command to execute on remote host. (templated)
:type command: str
Expand All @@ -45,7 +45,7 @@ class SSHOperator(BaseOperator):
:type do_xcom_push: bool
"""

template_fields = ('command',)
template_fields = ('command', 'remote_host')
template_ext = ('.sh',)

@apply_defaults
Expand Down

0 comments on commit 304f09a

Please sign in to comment.