Eason09053360 opened a new pull request, #73132:
URL: https://github.com/apache/airflow/pull/73132
## Why
Multi-team deployments assign a pool to a team through `team_name`, which
decides who may use that
pool. `airflowctl pools export` never wrote the field and `airflowctl pools
import` never read it
back, so a backup/restore cycle silently dropped that ownership.
Worse than an incomplete file: `PoolsOperations.bulk` serialises with a
plain `model_dump()`, so
the omitted field still goes out as `"team_name": null`, and
`BulkPoolService.handle_bulk_create`
treats it as explicitly provided and writes it over the existing row.
`airflowctl pools import
--action-on-existing-key overwrite` therefore clears the team on pools that
had one, and reports
success.
`airflow pools export` / `import` — which these commands supersede, and
which already carry a
`@deprecated_for_airflowctl` notice — do round-trip `team_name`. The field
reached the old CLI in
#68110 and was never carried over, so this only bites users who followed the
migration notice.
## What
In `airflow-ctl/src/airflowctl/ctl/commands/pool_command.py`, `export` now
emits `team_name` and
`_import_helper` reads it back with `pool_config.get("team_name")` — the
same spelling
`pool_import_helper` uses in the command this one replaces, so files written
before this change
still import.
`test_export_includes_team_name` and `test_import_forwards_team_name` cover
the two halves; the
latter asserts on the serialised bulk body, so it pins what actually reaches
the server. The
hand-rolled pool stubs in the existing export tests gained `team_name` to
stay in step with
`PoolResponse`.
### Open question
A hand-written file that *omits* `team_name` still sends null and still
clears the team on
overwrite. That is unchanged here — same root cause as `description` and
`include_deferred` being
reset to their defaults: `bulk()` sends every field unconditionally,
defeating the server's
`exclude_unset=True` guard. Fixing it means changing what `bulk()`
serialises, which shifts
overwrite semantics for those fields too and needs the same treatment in
`connection_command` and
`variable_command`. (`exclude_none=True`, as the sibling `pools.create` /
`pools.update` use, is
not enough — `description` defaults to `""` and `include_deferred` to
`False`.) Happy to open that
separately if you agree it should be split.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 5)
Generated-by: Claude Code (Opus 5) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
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]