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

Fix masterless jinja imports #54780

Merged
merged 3 commits into from Sep 29, 2019
Merged

Conversation

dwoz
Copy link
Contributor

@dwoz dwoz commented Sep 26, 2019

What does this PR do?

Fixes and adds tests for #54765 #54768

Tests written?

Yes

Commits signed with GPG?

Yes

@dwoz
Copy link
Contributor Author

dwoz commented Sep 26, 2019

re-run full all

@dwoz dwoz force-pushed the fix-masterless-jinja-imports branch 3 times, most recently from 0939d4e to 43e67a2 Compare September 26, 2019 19:00
@dwoz dwoz force-pushed the fix-masterless-jinja-imports branch from 43e67a2 to 00eba43 Compare September 26, 2019 19:10
@dwoz dwoz force-pushed the fix-masterless-jinja-imports branch from 00eba43 to 6aea83a Compare September 26, 2019 20:49
kiemlicz added a commit to kiemlicz/ambassador that referenced this pull request Sep 26, 2019
@kiemlicz
Copy link
Contributor

I've pulled the jinja.py and added to _utils dir in state tree root

Still getting:

{% from "_common/util.jinja" import retry with context %}    <======================

@s0undt3ch
Copy link
Member

@kiemlicz this PR adds a test which covers the proposed fix.

It seems that what you're trying to do is to "push" the fix to the minions through your state tree. That should be filed as a separate issue so we can better track it. It's not related to the change this PR is addressing.

@dwoz
Copy link
Contributor Author

dwoz commented Sep 27, 2019

re-run full all

Erik Johnson and others added 2 commits September 28, 2019 22:27
The addition of fileclient caching in the JinjaCacheLoader has broken
all jinja imports in state files, in masterless salt-call runs. This is
because masterless Pillar compilation uses the `PillarClient` while
regular file caching (states, etc.) use the `LocalClient`. Since Pillar
is compiled first in the masterless run, the class-level attribute where
the cached fileclient is stored only ever usese the PillarClient, and
thus any Jinja imports will cache the templates to the wrong location
(under `pillar_roots`).

This expands the cached fileclient support to distinguish between pillar
and non-pillar, and keep a separate cached fileclient for each.
@dwoz dwoz force-pushed the fix-masterless-jinja-imports branch 2 times, most recently from 29b31fc to e901a83 Compare September 28, 2019 22:29
@dwoz
Copy link
Contributor Author

dwoz commented Sep 28, 2019

This PR has the same patch as #54774 and adds tests

@kiemlicz
Copy link
Contributor

@s0undt3ch thanks for reply, now I'm truly disappointed

I know I can override the execution modules, state modules etc. using e.g. _utils dir from local state tree.
It was always the fastest way to 'port' the fixes to the running salt version, however it turns that it doesn't work for utils/jinja.py: why?

Overriding the local installed file: cp /srv/salt/base/_utils/jinja.py /usr/lib/python3/dist-packages/salt/utils/jinja.py proves that the fix is working, however the sudden inability to use _utils/ dir is frightening! Could you explain this please?

@dwoz dwoz merged commit b9459e6 into saltstack:2019.2.1 Sep 29, 2019
@dwoz dwoz deleted the fix-masterless-jinja-imports branch July 26, 2021 19:59
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.

None yet

7 participants