Skip to content

Loop until no eval master#55639

Merged
dwoz merged 21 commits intosaltstack:masterfrom
basisbeeld:loop_until-no-eval-master
Jan 4, 2020
Merged

Loop until no eval master#55639
dwoz merged 21 commits intosaltstack:masterfrom
basisbeeld:loop_until-no-eval-master

Conversation

@github-abcde
Copy link
Contributor

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?

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'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?

Yes

Commits signed with GPG?

Yes

@github-abcde github-abcde requested a review from a team as a code owner December 13, 2019 16:25
@ghost ghost requested a review from Akm0d December 13, 2019 16:25
@codecov
Copy link

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%> (?)

Copy link
Contributor

@waynew waynew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@dwoz dwoz merged commit f3f9195 into saltstack:master Jan 4, 2020
@github-abcde github-abcde deleted the loop_until-no-eval-master branch January 6, 2020 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants