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

Allow NamedLoaderContexts to be returned from loader #681

Conversation

vzhestkov
Copy link
Contributor

What does this PR do?

Backport of saltstack/salt#66649

It is useful in some cases to return NamedLoaderContexts from loaded functions. Instead of choking or requireing implimenters to call the context's value() method before being de-scoped, detect when a NamedLoaderContext has been returned and return the value from the current context.

What issues does this PR fix or reference?

saltstack/salt#66364 was opened for upstream before, but they decided to put the fix to 3006.x and a bit different way.
There was an unrelated bug opened when such behavior appered while testing. So no reference for now.

Previous Behavior

Could return the following instead of the proper dict:

demo.example.org:
    <salt.loader.context.NamedLoaderContext object at 0x7f31461b80a0>

New Behavior

Return the expected dict output

Merge requirements satisfied?

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

Commits signed with GPG?

Yes/No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

It is useful in some cases to return NamedLoaderContexts from loaded
functions. Instead of choking or requireing implimenters to call the
context's value() method before being de-scoped, detect when a
NamedLoaderContext has been returned and return the value from the
current context.
@vzhestkov vzhestkov merged commit 1be3f92 into openSUSE/release/3006.0 Sep 25, 2024
8 checks passed
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.

3 participants