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

Loop until no eval master #55639

merged 21 commits into from Jan 4, 2020


Copy link

@github-abcde github-abcde commented Dec 13, 2019

This is #53958, rebased on master.

What does this PR do?

It provides an alternative to loop.until that does not use eval.
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?


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's operator, 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?


Commits signed with GPG?


@github-abcde github-abcde requested a review from as a code owner Dec 13, 2019
@ghost ghost requested a review from Akm0d Dec 13, 2019
Copy link

@codecov codecov bot commented Dec 24, 2019

Codecov Report

No coverage uploaded for pull request base (master@258e77f). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #55639   +/-   ##
  Coverage          ?   38.36%           
  Files             ?     1464           
  Lines             ?   260186           
  Branches          ?    54980           
  Hits              ?    99789           
  Misses            ?   149039           
  Partials          ?    11358
Flag Coverage Δ
#amazon1 38.36% <0%> (?)
#py2 38.36% <0%> (?)
#runtests 38.36% <0%> (?)
#zeromq 38.36% <0%> (?)

waynew approved these changes Dec 27, 2019
Copy link

@waynew waynew left a comment

Looks great! Just merged the most recent changes in, but this should be ready to go once tests pass.

@waynew waynew added this to PR needs merge to master in PRs to port to master via automation Dec 27, 2019
salt/states/ Outdated Show resolved Hide resolved
dwoz approved these changes Jan 4, 2020
@dwoz dwoz merged commit f3f9195 into saltstack:master Jan 4, 2020
49 checks passed
PRs to port to master automation moved this from PR needs merge to master to PR merged Jan 4, 2020
@github-abcde github-abcde deleted the loop_until-no-eval-master branch Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Successfully merging this pull request may close these issues.

None yet

3 participants