[BUG] support list values for event_id in salt.wait_for_event #60430
Labels
Bug
broken, incorrect, or confusing behavior
severity-medium
3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I am trying to use salt orchestration to wait for "old" nodes of a given role to go away because I cannot perform an operation on new nodes of given role until that occurs.
To do this, I would like to listen to
salt/presence/change
events and haveid_list
look for values inlost
.This currently does not work because wait_for_event expects the value for
event_id
to be astr
and does not supportlist[str]
Offending line here: https://github.com/saltstack/salt/blob/v3003/salt/states/saltmod.py#L668
Given the following orchestration state:
and an event that looks like this:
A value exception is thrown because the linked line is doing:
This is caught with:
Describe the solution you'd like
A clear and concise description of what you want to happen.
When the event value retrieved from the location @
event_id
is a list, iterate through it and pop any values thatmatch a value in
id_list
off ofid_list
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Option 1:
Salt mine that gets updated by a reactor + orchestration when a node is lost, that way "new" nodes can tell approximately when an "old" node is lost. It seems like overkill to have a reactor + orchestration just to call salt mine.update.
Option 2:
Use something like test.ping to try and find nodes that are no longer responding but I'd still have to do something like
loop.until
or something similar.Option 3:
Have a reactor kick off orchestration to re-emit a custom event with just the id of one node when
salt/presence/change
is emitted, then have my orchestration wait on that custom event.If there are any other ways that this can be done, open to hearing those but I'd really like to just be able to react when a minion goes goes offline.
I am also happy to contribute to this, it doesn't seem that difficult to accomplish, opening an FR to see if I'm missing something or if there are better/existing ways to do this.
Option 4 (what I ended up doing today):
Have a reactor meant for my specific subset of events listen to ALL presence change events, then do a bunch of jinja2 to determine if my old nodes are still working. I only don't like this because its kicking off orchestration for all presence events for all nodes, not just the nodes I'm interested in, so most executions of the orchestration won't end up doing anything.
Additional context
Add any other context or screenshots about the feature request here.
Please Note
If this feature request would be considered a substantial change or addition, this should go through a SEP process here https://github.com/saltstack/salt-enhancement-proposals, instead of a feature request.
The text was updated successfully, but these errors were encountered: