Suraj-kumar00 commented on code in PR #67947:
URL: https://github.com/apache/airflow/pull/67947#discussion_r3565948092
##########
airflow-ctl/src/airflowctl/api/operations.py:
##########
@@ -733,10 +737,19 @@ def delete(self, pool: str) -> str | ServerResponseError:
def update(self, pool_body: PoolPatchBody) -> PoolResponse |
ServerResponseError:
"""Update a pool."""
- try:
- self.response = self.client.patch(
- f"pools/{pool_body.pool}",
json=pool_body.model_dump(mode="json")
- )
+ # Workaround: the server's PATCH handler validates the partial body
+ # against ``BasePool`` (see airflow-core/.../services/public/pools.py)
+ # which requires ``include_deferred``. Omitting it fails with
+ # "Field required", sending ``null`` fails with "bool_type". When the
+ # user did not specify ``include_deferred``, fetch the pool's current
+ # value so we satisfy the validator without silently flipping the
+ # existing setting.
+ body = pool_body.model_dump(mode="json", exclude_none=True)
+ if "include_deferred" not in body:
+ current =
PoolResponse.model_validate_json(self.client.get(f"pools/{pool_body.pool}").content)
+ body["include_deferred"] = current.include_deferred
+ try:
+ self.response = self.client.patch(f"pools/{pool_body.pool}",
json=body)
Review Comment:
Removed. PoolsOperations.update is now byte-identical to main. Context: the
bool-defaults fix below surfaced a pre-existing server-side quirk where the
pools PATCH handler validates the partial body against the non-partial
BasePool, making include_deferred effectively required. I will file that
separately instead of working around it here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]