Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
It provides an alternative to
loop.until
that does not useeval
.Added example for using this in the faq. Made some pylint-inspired changes.
I'm not entirely sure that the name of the new state
until_no_eval
is good enough (even though it is accurate), since it feels wrong to name a function with something that it does not have. I'm open to suggestions on this.What issues does this PR fix or reference?
None
Previous Behavior
The generic state that allows you to (blockingly) execute a salt function until it produces a desired output hinged on using
eval
with user-input. Since this is potentially very dangerous, an alternative has been supplied.New Behavior
A state exists (
loop.until_no_eval
) that will block execution until a specific salt execution module function returns an expected result. This produced result is passed together with the expected result to a function (either a method of python'soperator
, a function from__salt__
or__utils__
) to produce a boolean indicating success (or failure).Additionally, a parameter
init_wait
is available to configure a waiting period before the 1st call of the salt function is made.Tests written?
Yes
Commits signed with GPG?
Yes