This is an automated email from the ASF dual-hosted git repository.
husseinawala pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new e028e38db7 Allow SSHOperator.skip_on_exit_code to be zero (#36358)
e028e38db7 is described below
commit e028e38db74b2a01acf19588ae86caed8c26796e
Author: Maxim Martynov <[email protected]>
AuthorDate: Fri Dec 22 01:23:27 2023 +0300
Allow SSHOperator.skip_on_exit_code to be zero (#36358)
---
airflow/providers/ssh/operators/ssh.py | 2 +-
tests/providers/ssh/operators/test_ssh.py | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/airflow/providers/ssh/operators/ssh.py
b/airflow/providers/ssh/operators/ssh.py
index 621dc47539..ca5d450c0d 100644
--- a/airflow/providers/ssh/operators/ssh.py
+++ b/airflow/providers/ssh/operators/ssh.py
@@ -114,7 +114,7 @@ class SSHOperator(BaseOperator):
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 []
)
diff --git a/tests/providers/ssh/operators/test_ssh.py
b/tests/providers/ssh/operators/test_ssh.py
index 241f3c8c7b..0cb42544ba 100644
--- a/tests/providers/ssh/operators/test_ssh.py
+++ b/tests/providers/ssh/operators/test_ssh.py
@@ -208,13 +208,19 @@ class TestSSHOperator:
[
({}, 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),
],