Skip to content

[master] Add onlyifrunning option for Service Beacon#66809

Merged
dwoz merged 1 commit intosaltstack:masterfrom
SndR85:feature/beacon-service-add-matching-state
Jan 30, 2026
Merged

[master] Add onlyifrunning option for Service Beacon#66809
dwoz merged 1 commit intosaltstack:masterfrom
SndR85:feature/beacon-service-add-matching-state

Conversation

@SndR85
Copy link
Contributor

@SndR85 SndR85 commented Aug 15, 2024

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.

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 SndR85 requested a review from a team as a code owner August 15, 2024 09:52
@SndR85 SndR85 requested a review from felippeb August 15, 2024 09:52
@salt-project-bot-prod-environment salt-project-bot-prod-environment bot changed the title Add onlyifrunning option for Service Beacon [master] Add onlyifrunning option for Service Beacon Aug 15, 2024
@SndR85 SndR85 force-pushed the feature/beacon-service-add-matching-state branch 2 times, most recently from d55137e to fd955f8 Compare August 15, 2024 10:16
@SndR85 SndR85 force-pushed the feature/beacon-service-add-matching-state branch from fd955f8 to 38a5731 Compare August 15, 2024 11:32
@Sxderp
Copy link
Contributor

Sxderp commented Aug 15, 2024

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

@SndR85
Copy link
Contributor Author

SndR85 commented Aug 16, 2024

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?

With this option it's able to only fire events that match the running state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants