From c59c38b523204210865d16d9b60c6c316ae8e7c5 Mon Sep 17 00:00:00 2001 From: Yeonguk Choo Date: Sat, 20 Dec 2025 03:30:08 +0900 Subject: [PATCH] [v3-1-test] fix(cli): Set server context for connections (#59624) (cherry picked from commit caa81a74c381658ebdbe264aaaea7a6bedea953e) Co-authored-by: Yeonguk Choo --- airflow-core/src/airflow/cli/commands/connection_command.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/airflow-core/src/airflow/cli/commands/connection_command.py b/airflow-core/src/airflow/cli/commands/connection_command.py index 7fe430c05bfe3..6cf4378c42aa4 100644 --- a/airflow-core/src/airflow/cli/commands/connection_command.py +++ b/airflow-core/src/airflow/cli/commands/connection_command.py @@ -65,6 +65,8 @@ def _connection_mapper(conn: Connection) -> dict[str, Any]: @providers_configuration_loaded def connections_get(args): """Get a connection.""" + os.environ["_AIRFLOW_PROCESS_CONTEXT"] = "server" + try: conn = Connection.get_connection_from_secrets(args.conn_id) except AirflowNotFoundException: @@ -358,6 +360,8 @@ def _import_helper(file_path: str, overwrite: bool) -> None: @providers_configuration_loaded def connections_test(args) -> None: """Test an Airflow connection.""" + os.environ["_AIRFLOW_PROCESS_CONTEXT"] = "server" + console = AirflowConsole() if conf.get("core", "test_connection", fallback="Disabled").lower().strip() != "enabled": console.print(