salt icon indicating copy to clipboard operation
salt copied to clipboard

[master] Add onlyifrunning option for Service Beacon

Open SndR85 opened this issue 1 year ago • 3 comments

With this option it's able to only fire events that match the running state

What does this PR do?

I added this change because I don't want my Salt master being overloaded with events I'm not interested in. In my case I only would receive an event when the service is stopped. Without this change the event bus is, for all connected minions, overloaded with events about the running services which I will ignore. This will filter these events from the beacon directly.

What issues does this PR fix or reference?

Previous Behavior

Without this option it will fire the event without filtering the running state

New Behavior

It allows the user to configure that an event should only be fired when the running state is matched with what's configured per service.

Merge requirements satisfied?

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

  • [X] Docs
  • [x] Changelog - https://docs.saltproject.io/en/master/topics/development/changelog.html
  • [X] Tests written/updated

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices, including the PR Guidelines.

See GitHub's page on GPG signing for more information about signing commits with GPG.

SndR85 avatar Aug 15 '24 09:08 SndR85

I think the name of this should change.

onlyifrunning: True Implies, to me, that the item will only trigger if running (matches PR).

onlyifrunning: False Implies, to me, that the item will trigger regardless of running state (does not match the PR).

Perhaps something like on_running_state: (True|False|None) or is_running_state: (True|False|None) ?

Sxderp avatar Aug 15 '24 15:08 Sxderp

Ah, yes. I was a bit lost in naming the parameter. Maybe filter should be added, as it will filter out only the matched state? Something like is_running_state_filter?

SndR85 avatar Aug 16 '24 07:08 SndR85

@Sxderp I have renamed the parameter to is_running_state.

SndR85 avatar Aug 21 '24 10:08 SndR85