Skip to content

Commit

Permalink
Allow SSHOperator.skip_on_exit_code to be zero (#36358)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Dec 21, 2023
1 parent 7084429 commit e028e38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion airflow/providers/ssh/operators/ssh.py
Expand Up @@ -114,7 +114,7 @@ def __init__(
skip_on_exit_code
if isinstance(skip_on_exit_code, Container)
else [skip_on_exit_code]
if skip_on_exit_code
if skip_on_exit_code is not None
else []
)

Expand Down
6 changes: 6 additions & 0 deletions tests/providers/ssh/operators/test_ssh.py
Expand Up @@ -208,13 +208,19 @@ def test_ssh_client_managed_correctly(self):
[
({}, 0, None),
({}, 100, AirflowException),
({}, 101, AirflowException),
({"skip_on_exit_code": None}, 0, None),
({"skip_on_exit_code": None}, 100, AirflowException),
({"skip_on_exit_code": None}, 101, AirflowException),
({"skip_on_exit_code": 100}, 0, None),
({"skip_on_exit_code": 100}, 100, AirflowSkipException),
({"skip_on_exit_code": 100}, 101, AirflowException),
({"skip_on_exit_code": 0}, 0, AirflowSkipException),
({"skip_on_exit_code": [100]}, 0, None),
({"skip_on_exit_code": [100]}, 100, AirflowSkipException),
({"skip_on_exit_code": [100]}, 101, AirflowException),
({"skip_on_exit_code": [100, 102]}, 101, AirflowException),
({"skip_on_exit_code": (100,)}, 0, None),
({"skip_on_exit_code": (100,)}, 100, AirflowSkipException),
({"skip_on_exit_code": (100,)}, 101, AirflowException),
],
Expand Down

0 comments on commit e028e38

Please sign in to comment.