1fanwang opened a new pull request, #70342:
URL: https://github.com/apache/airflow/pull/70342
`mounts` is a template field, so it is rendered after `__init__` runs. The
constructor converted dict mounts into `Mount` objects and tagged each one with
`template_fields = ("Source", "Target", "Type")` so their nested values would
render. `Mount` is a `dict` subclass, so Jinja already renders its values
natively — the conversion and tagging in `__init__` are the template-field
logic #70296 is burning down. Keep the raw input in `__init__` and convert to
`Mount` objects at the start of `execute()`, after rendering.
related: #70296
<details><summary>Testing Done</summary>
`test_dict_mounts_are_normalized_to_mount_objects` now drives `execute()`
end to end and asserts the mounts reaching `create_host_config` are `Mount`
objects with the expected `Source`/`Target`/`ReadOnly`.
`test_dict_mounts_are_templated` renders a templated dict mount and asserts the
value resolves. Both fail on the pre-fix source (mounts were normalized to
`Mount` in `__init__`, so the raw dict / lowercase keys assertions don't hold)
and pass after. `test_docker.py`: 61 passed. `validate_operators_init.py` on
the operator exits 0.
</details>
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: GitHub Copilot CLI 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]