Skip to content

Fix 68572 cp get template context#68712

Draft
harshang03 wants to merge 3 commits intosaltstack:masterfrom
harshang03:fix-68572-cp-get-template-context
Draft

Fix 68572 cp get template context#68712
harshang03 wants to merge 3 commits intosaltstack:masterfrom
harshang03:fix-68572-cp-get-template-context

Conversation

@harshang03
Copy link

What does this PR do?

Fixes cp.get_template Jinja rendering when templates use import ... with context by normalizing the render context and safely handling missing loader-backed salt data, plus a unit test for the import-with-context path.

What issues does this PR fix or reference?

Fixes #68572

Previous Behavior

cp.get_template could raise a KeyError/AttributeError when a Jinja template used import ... with context because salt could be None in the render context

New Behavior

Jinja rendering safely handles missing loader-backed context, so import ... with context works without errors in cp.get_template.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: cp.get_template throws KeyError when template has an import with context

1 participant