Skip to content

[AIRFLOW-6402] fix ssh_operator default value#7008

Closed
ohadmata wants to merge 2 commits intoapache:v1-10-stablefrom
ohadmata:ohadmata-ssh_operator_fix
Closed

[AIRFLOW-6402] fix ssh_operator default value#7008
ohadmata wants to merge 2 commits intoapache:v1-10-stablefrom
ohadmata:ohadmata-ssh_operator_fix

Conversation

@ohadmata
Copy link
Contributor

@ohadmata ohadmata commented Jan 2, 2020

[AIRFLOW-6402] https://issues.apache.org/jira/browse/AIRFLOW-6402

Fix for ssh operator default value.
Right now I am getting Nonetype Exception (1.10.7)

@ohadmata ohadmata changed the title fix ssh_operator default value [AIRFLOW-6402] fix ssh_operator default value Jan 2, 2020
blank line contains whitespace
@kaxil
Copy link
Member

kaxil commented Jan 9, 2020

Can you also add a test for it so this can be avoided in future, please?

Test for this operator are at: https://github.com/apache/airflow/blob/master/tests/contrib/operators/test_ssh_operator.py

@dstandish
Copy link
Contributor

dstandish commented Jan 10, 2020

this operator raises exception if no command is provided:

if not self.command:
raise AirflowException("SSH command not specified. Aborting.")

does it make sense to just pass empty string super().__init__(command='') when subclassing?

seems like it would make sense to make command not optional i.e. remove the default value of None

@stale
Copy link

stale bot commented Feb 24, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Feb 24, 2020
@kaxil kaxil removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Feb 24, 2020
@kaxil
Copy link
Member

kaxil commented Feb 24, 2020

this operator raises exception if no command is provided:

if not self.command:
raise AirflowException("SSH command not specified. Aborting.")

does it make sense to just pass empty string super().__init__(command='') when subclassing?

seems like it would make sense to make command not optional i.e. remove the default value of None

Yes, I don't see why someone would use SSHOperator without a "command".

@stale
Copy link

stale bot commented May 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label May 19, 2020
@stale stale bot closed this May 29, 2020
@CRX-DS
Copy link

CRX-DS commented Dec 31, 2020

Should this TASK work now?:
t1 = SSHOperator(
task_id='t1',
bash_command='echo 5',
ssh_conn_id='myconnection1',
dag=dag
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments