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

henry3260 pushed a commit to branch airflow-ctl/v0-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/airflow-ctl/v0-1-test by this 
push:
     new 52e0140abaa [airflow-ctl/v0-1-test] Fix airflowctl backfill 
pause/unpause/cancel always failing with 405 (#73282) (#73293)
52e0140abaa is described below

commit 52e0140abaadd467fa9a51ffe5e8974288322799
Author: Henry Chen <[email protected]>
AuthorDate: Fri Sep 18 03:23:00 2026 +0800

    [airflow-ctl/v0-1-test] Fix airflowctl backfill pause/unpause/cancel always 
failing with 405 (#73282) (#73293)
    
    The API server registers these three backfill routes as PUT only, so every
    invocation was rejected before reaching the handler. The commands have never
    worked since the routes were introduced in the AIP-84 migration, which means
    an operator cannot stop a backfill that is consuming the cluster.
    
    The three tests covering them asserted only the request path, so the mock
    transport accepted any verb and kept the mismatch green all along.
    
    
    (cherry picked from commit c4ab0c326d2223b05c845ae33c2bc196ca642d58)
    
    Co-authored-by: Y-C <[email protected]>
    Co-authored-by: Eason09053360 
<[email protected]>
---
 airflow-ctl/src/airflowctl/api/operations.py         | 6 +++---
 airflow-ctl/tests/airflow_ctl/api/test_operations.py | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/airflow-ctl/src/airflowctl/api/operations.py 
b/airflow-ctl/src/airflowctl/api/operations.py
index dd6608f2510..08f09e2f740 100644
--- a/airflow-ctl/src/airflowctl/api/operations.py
+++ b/airflow-ctl/src/airflowctl/api/operations.py
@@ -429,7 +429,7 @@ class BackfillOperations(BaseOperations):
     def pause(self, backfill_id: str) -> BackfillResponse | 
ServerResponseError:
         """Pause a backfill."""
         try:
-            self.response = self.client.post(f"backfills/{backfill_id}/pause")
+            self.response = self.client.put(f"backfills/{backfill_id}/pause")
             return BackfillResponse.model_validate_json(self.response.content)
         except ServerResponseError as e:
             raise e
@@ -437,7 +437,7 @@ class BackfillOperations(BaseOperations):
     def unpause(self, backfill_id: str) -> BackfillResponse | 
ServerResponseError:
         """Unpause a backfill."""
         try:
-            self.response = 
self.client.post(f"backfills/{backfill_id}/unpause")
+            self.response = self.client.put(f"backfills/{backfill_id}/unpause")
             return BackfillResponse.model_validate_json(self.response.content)
         except ServerResponseError as e:
             raise e
@@ -445,7 +445,7 @@ class BackfillOperations(BaseOperations):
     def cancel(self, backfill_id: str) -> BackfillResponse | 
ServerResponseError:
         """Cancel a backfill."""
         try:
-            self.response = self.client.post(f"backfills/{backfill_id}/cancel")
+            self.response = self.client.put(f"backfills/{backfill_id}/cancel")
             return BackfillResponse.model_validate_json(self.response.content)
         except ServerResponseError as e:
             raise e
diff --git a/airflow-ctl/tests/airflow_ctl/api/test_operations.py 
b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
index 9d6aed4e804..1cd123ada78 100644
--- a/airflow-ctl/tests/airflow_ctl/api/test_operations.py
+++ b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
@@ -619,6 +619,7 @@ class TestBackfillOperations:
 
     def test_pause(self):
         def handle_request(request: httpx.Request) -> httpx.Response:
+            assert request.method == "PUT"
             assert request.url.path == 
f"/api/v2/backfills/{self.backfill_id}/pause"
             return httpx.Response(200, 
json=json.loads(self.backfill_response.model_dump_json()))
 
@@ -628,6 +629,7 @@ class TestBackfillOperations:
 
     def test_unpause(self):
         def handle_request(request: httpx.Request) -> httpx.Response:
+            assert request.method == "PUT"
             assert request.url.path == 
f"/api/v2/backfills/{self.backfill_id}/unpause"
             return httpx.Response(200, 
json=json.loads(self.backfill_response.model_dump_json()))
 
@@ -637,6 +639,7 @@ class TestBackfillOperations:
 
     def test_cancel(self):
         def handle_request(request: httpx.Request) -> httpx.Response:
+            assert request.method == "PUT"
             assert request.url.path == 
f"/api/v2/backfills/{self.backfill_id}/cancel"
             return httpx.Response(200, 
json=json.loads(self.backfill_response.model_dump_json()))
 

Reply via email to