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

FEAT 60430: Add ability for wait_for_event to handle list event_id values #60443

Merged
merged 20 commits into from
Oct 5, 2022

Conversation

jwyoungpm
Copy link
Contributor

@jwyoungpm jwyoungpm commented Jun 25, 2021

What does this PR do?

Adds support for comparing id_list with a list when the value for event_id is a list in the salt.wait_for_event module.

What issues does this PR fix or reference?

Fixes #60430

Previous Behavior

Previously, salt.wait_for_event only supported event_id values that where str.

New Behavior

In addition to the previous behavior, now supports event_id values that are lists.

Given the event:

{
   "data": {
      "new": [], 
      "lost": [
         "some_old_node"
      ], 
      "_stamp': '2021-06-23T15:02:04.621354"
     }, 
     "tag": "salt/presence/change"
}

the following salt.wait_for_event would not work peviously:

wait-for-node-death:
  salt.wait_for_event:
    - name: salt/presence/change
    - id_list:
       - some_old_node
    - timeout: 3000
    - event_id: lost

This PR checks if the val returned by the event_id location in the event is a list and if so, pops off any values from id_list that it finds in val

Merge requirements satisfied?

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

Commits signed with GPG?

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.

@jwyoungpm jwyoungpm requested a review from a team as a code owner June 25, 2021 16:28
@jwyoungpm jwyoungpm requested review from krionbsd and removed request for a team June 25, 2021 16:28
@welcome
Copy link

welcome bot commented Jun 25, 2021

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@sagetherage sagetherage added the Feature new functionality including changes to functionality and code refactors, etc. label Jul 12, 2021
@sagetherage sagetherage requested a review from s0undt3ch July 12, 2021 21:11
salt/states/saltmod.py Outdated Show resolved Hide resolved
salt/states/saltmod.py Outdated Show resolved Hide resolved
more pythonic if/then/else on list

Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
@jwyoungpm jwyoungpm requested a review from s0undt3ch July 14, 2021 19:44
@sagetherage sagetherage added Bug broken, incorrect, or confusing behavior and removed Feature new functionality including changes to functionality and code refactors, etc. labels Jul 22, 2021
@jwyoungpm
Copy link
Contributor Author

@krionbsd sorry I haven't come back and checked on this, out on paternity :)

Could someone have a look at this? Let me know if there are any blockers to merging.

@jwyoungpm
Copy link
Contributor Author

@krionbsd @s0undt3ch Sorry for the very late follow up on this...I got back from paternity leave not long ago, I believe this is still a valid MR. Is this still something I could get merged? You both have approved but I can't click the merge button.

Thanks!

@Ch3LL Ch3LL added the Sulfur v3006.0 release code name and version label Oct 4, 2022
@Ch3LL Ch3LL merged commit 8006ca5 into saltstack:master Oct 5, 2022
@welcome
Copy link

welcome bot commented Oct 5, 2022

Congratulations on your first PR being merged! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Sulfur v3006.0 release code name and version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] support list values for event_id in salt.wait_for_event
5 participants