Skip to content

fix: erroneous "new" minion presence events on process startup#64508

Draft
raddessi wants to merge 10 commits intosaltstack:3006.xfrom
raddessi:3006.x.maintenence-restart-cache-presence-data
Draft

fix: erroneous "new" minion presence events on process startup#64508
raddessi wants to merge 10 commits intosaltstack:3006.xfrom
raddessi:3006.x.maintenence-restart-cache-presence-data

Conversation

@raddessi
Copy link
Contributor

@raddessi raddessi commented Jun 20, 2023

What does this PR do?

This fixes the issue of the master processes sending incorrect presence events on either the restart of the salt-master process or any of the Maintenance process restart events (default is every hour). This issue began in 3006.0.

Although this was intended to fix the hourly incorrect presence update this also fixes the spammy presence updates between salt-master process restarts.

What issues does this PR fix or reference?

Fixes: #64505

Previous Behavior

The salt-master process sends incorrect presence events at every restart_interval of the Maintenance process, signalling that every node connected to the master is "new".

New Behavior

Only actual presence events are sent.

Merge requirements satisfied?

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

I will update all of these once this is commented on and direction is approved.

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

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

@salt-project-bot-prod-environment salt-project-bot-prod-environment bot changed the title feat: Cache presence data between process restarts [3006.x] feat: Cache presence data between process restarts Jun 20, 2023
@raddessi raddessi changed the title [3006.x] feat: Cache presence data between process restarts WIP: feat: Cache presence data between process restarts Jun 20, 2023
@raddessi
Copy link
Contributor Author

Just as background info, I noticed this because I use the slack engine and presence reactor.

@raddessi raddessi temporarily deployed to ci June 20, 2023 05:18 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 05:18 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 05:18 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 05:18 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 05:35 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 05:36 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:29 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:29 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:29 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:29 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:30 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:30 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:50 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:50 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:50 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:50 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:50 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci June 20, 2023 06:50 — with GitHub Actions Inactive
@raddessi raddessi marked this pull request as ready for review June 20, 2023 18:09
@raddessi raddessi requested a review from a team as a code owner June 20, 2023 18:09
@raddessi raddessi requested review from cmcmarrow and removed request for a team June 20, 2023 18:09
@raddessi raddessi changed the title WIP: feat: Cache presence data between process restarts feat: cache presence data between process restarts Jun 22, 2023
@whytewolf
Copy link
Collaborator

so, this should not be labeled a feature, or it should be going into master. if this is a fix for a bug it should be labeled as such. if it is a new feature it needs to go into master.

Next, it is going to need a set of tests and changelog. as well as fixing the pre-commit which just looks like an isort issue.

@raddessi
Copy link
Contributor Author

raddessi commented Jun 22, 2023

| so, this should not be labeled a feature, or it should be going into master

Good point. I started writing this as a feature but it does appear to be more of a bug fix at this point. I'll swap the title thank you.

I'll add tests etc once I get approval on the concept. I don't want to spend time on that if this gets denied

@raddessi raddessi temporarily deployed to ci September 27, 2023 21:26 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci September 27, 2023 21:28 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci September 27, 2023 21:28 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci September 27, 2023 22:09 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci September 27, 2023 22:09 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci September 27, 2023 22:09 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci September 27, 2023 22:09 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci September 27, 2023 22:09 — with GitHub Actions Inactive
@raddessi raddessi temporarily deployed to ci September 27, 2023 22:09 — with GitHub Actions Inactive
@raddessi
Copy link
Contributor Author

raddessi commented Nov 8, 2023

Apologies for the bump, can I get another review when you have time @dwoz - Thanks!

If this looks good I will add tests and docs

@raddessi
Copy link
Contributor Author

raddessi commented Nov 22, 2023

bumping this @dwoz @cmcmarrow, if the implementation looks good I will add tests

@raddessi
Copy link
Contributor Author

test added

@raddessi
Copy link
Contributor Author

Changelog entry added, I don't think we need docs on this one as I said above. Ready to go if you think this is the right approach 🤞

Not that I would like to add more work for myself but does this need to be able to wipe the cache file if it becomes corrupted for some reason?

Comment on lines 7 to 27
import salt.utils.platform
from tests.support.mock import patch
from tests.support.mock import MagicMock, patch


@pytest.fixture
def maintenance_opts(master_opts):
"""
Options needed for master's Maintenence class
"""
opts = master_opts.copy()
opts.update(git_pillar_update_interval=180, maintenance_interval=181)
yield opts


@pytest.fixture
def maintenance(maintenance_opts):
"""
The master's Maintenence class
"""
return salt.master.Maintenance(maintenance_opts)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied this in from master

@raddessi
Copy link
Contributor Author

wait this needs to check for the change event also dammit. Will fix

@dwoz
Copy link
Contributor

dwoz commented Feb 4, 2025

Are these conflicts able to be resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants