Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly set finalize for the new environment #76435

Merged
merged 2 commits into from Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/76379-set-finalize-on-new-env.yml
@@ -0,0 +1,2 @@
bugfixes:
- "``Templar.copy_with_new_env`` - set the ``finalize`` method of the new ``Templar`` object for the new environment (https://github.com/ansible/ansible/issues/76379)"
1 change: 1 addition & 0 deletions lib/ansible/template/__init__.py
Expand Up @@ -698,6 +698,7 @@ def copy_with_new_env(self, environment_class=AnsibleEnvironment, **kwargs):
new_templar = object.__new__(Templar)
new_templar.__dict__.update(self.__dict__)
new_templar.environment = new_env
new_templar.environment.finalize = new_templar._finalize

new_templar.jinja2_native = environment_class is AnsibleNativeEnvironment

Expand Down