This is an automated email from the ASF dual-hosted git repository.

shahar1 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 6cac8fcddc1 Handle None response from airflowctl connections 
create-defaults (#68853)
6cac8fcddc1 is described below

commit 6cac8fcddc1575f4841c6991b2ba1003a260fa93
Author: Pratiksha Badheka <[email protected]>
AuthorDate: Tue Oct 27 19:35:18 2026 +0530

    Handle None response from airflowctl connections create-defaults (#68853)
---
 airflow-ctl/src/airflowctl/ctl/cli_config.py         |  3 +++
 airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/airflow-ctl/src/airflowctl/ctl/cli_config.py 
b/airflow-ctl/src/airflowctl/ctl/cli_config.py
index 25c14203b67..226328269a4 100755
--- a/airflow-ctl/src/airflowctl/ctl/cli_config.py
+++ b/airflow-ctl/src/airflowctl/ctl/cli_config.py
@@ -945,6 +945,9 @@ class CommandFactory:
                 # Handle delete operation which returns a string of the 
deleted entity name
                 if isinstance(obj, str):
                     return {"operation": api_operation_name, "entity": obj}
+                # Handle operations that return None (e.g., create_defaults)
+                if obj is None:
+                    return {"operation": api_operation_name, "status": 
"success"}
                 return obj
 
             def check_operation_and_collect_list_of_dict(dict_obj: dict, 
top_level: bool = False) -> list:
diff --git a/airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py 
b/airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py
index 4e8bf00c906..ce8b76fa43e 100644
--- a/airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py
+++ b/airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py
@@ -1140,6 +1140,19 @@ class TestCliConfigMethods:
 
         assert mocked_print_as.call_args.kwargs["output"] == "json"
 
+    @mock.patch.object(AirflowConsole, "print_as", autospec=True)
+    @mock.patch.object(ConnectionsOperations, "create_defaults", autospec=True)
+    def test_operation_returning_none_prints_success(self, 
mocked_create_defaults, mocked_print_as):
+        """An operation that returns nothing is reported as a successful 
operation row."""
+        mocked_create_defaults.return_value = None
+        args = cli_parser.get_parser().parse_args(["connections", 
"create-defaults"])
+
+        args.func(args, api_client=mock.MagicMock(spec=Client))
+
+        assert mocked_print_as.call_args.kwargs["data"] == [
+            {"operation": "create_defaults", "status": "success"}
+        ]
+
     @pytest.mark.parametrize(
         ("output", "parse", "expected"),
         [

Reply via email to