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

Fix redis cache #67125

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix redis cache #67125

wants to merge 3 commits into from

Conversation

dexterlb
Copy link

@dexterlb dexterlb commented Jan 2, 2025

Since commit 9233e1c the redis_cache module seems to have been broken in multiple places:

The format of timestamp keys is malformed

This is because of an apparent attempt to refactor code to be compatible with older versions of python: the refactored code contains a silly copy-paste error that results in curly braces appearing in the keys, which breaks timestamp handling.

This PR fixes this mistake.

Listing child banks is broken, which results in commands like salt-run cache.list minions returning nothing every time

Child banks should be listed with _get_bank_redis_key instead of _get_bank_keys_redis_key

This PR fixes this mistake.

New objects get inserted in the wrong paths

The function _build_bank_hier seems to have been refactored from using a for-loop and several accumulating variables into a more functional style with itertools.accumulate. However, instead of adding the names of child banks as set-members into the parent bank, the refactored code only adds a "." member into each newly-created bank. This is a bug and causes all queries for nested banks to fail.

This PR rewrites the function in a way that:

  • Retains the functional style established by commit 9233e1c
  • Reimplements the old behaviour of inserting the names of child banks into parent banks
  • Retains the logic that adds a "." member into newly-created banks

@dexterlb dexterlb requested a review from a team as a code owner January 2, 2025 21:12
Copy link

welcome bot commented Jan 2, 2025

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 [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!

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.

1 participant