You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
After switching our SaltStack installation from the localfs cache backend to the Redis cache backend, we encountered issues with mine.update and mine.get. These problems were introduced by this commit.
Regression Issues:
When listing minions from Redis, Salt queries the incorrect Redis/Valkey SET ("$BANKEY@minions"), preventing minion retrieval. This is due to changes in how banks are referenced in the list function.
The _build_bank_hier function writes "." as the value, causing the Redis SET ("$BANK@minions") to contain only "." instead of the expected list of minions.
According to SaltStack Documentation:
"$BANK_*" is a Redis SET containing the list of banks under the current bank, rather than always being ".".
[root@salt-test ~]# cat /etc/salt/minion
hash_type: sha256
id: salt-test
log_level: info
master: salt-test.cloud.phx3.gdg
mine_functions:
grains.item:
- os
[root@salt-test ~]#
Please be as specific as possible and give set-up details.
on-prem machine
Install:
salt-3007.1-0.x86_64
redis or valkey (same issue observed with both)
python3-redis (dnf install python3-redis -y)
redis module (salt-pip install redis)
Steps to Reproduce the behavior
Using the contents above for /etc/salt/master for salt-master and /etc/salt/minion for salt-minion run the following command so the minions "mine" and "data" is written to the redis cache:
salt 'salt-test' mine.update
salt 'salt-test' saltutil.refresh_grains
Use mine.get targeting with grain or compound as the target type:
Reverting this line changed of the list function in redis_cache.py and restarting salt-master resolves the issue and the correct SET of "$BANK@minions" is then queried:
Reverting the code in the "_build_bank_hier" function to the code in prior to the commit that caused the regression and restarting salt-master results in the following observed in redis/valkey when salt 'salt-test' mine.update is ran:
"[0 127.0.0.1:50170] "SADD" "$BANK@minions" "salt-test""
Should be the expected result so that "$BANK@minions" is a Redis SET containing the list of banks.
The salt-master debug logs for redis_cache.py inserting these items:
2025-02-03 20:04:47,899 [/opt/saltstack/salt/lib/python3.10/site-packages/salt/cache/redis_cache.py:345 ][DEBUG ][150074] Adding salt-test to $BANK@minions
2025-02-03 20:04:47,899 [/opt/saltstack/salt/lib/python3.10/site-packages/salt/cache/redis_cache.py:390 ][DEBUG ][150074] Setting the value for mine under minions/salt-test ($KEY@minions/salt-test/mine)
2025-02-03 20:04:47,899 [/opt/saltstack/salt/lib/python3.10/site-packages/salt/cache/redis_cache.py:397 ][DEBUG ][150074] Adding mine to $BANKEYS@minions/salt-test
Description
After switching our SaltStack installation from the
localfs
cache backend to the Redis cache backend, we encountered issues withmine.update
andmine.get
. These problems were introduced by this commit.Regression Issues:
When listing minions from Redis, Salt queries the incorrect Redis/Valkey
![Image](https://private-user-images.githubusercontent.com/33382280/409283508-8225e485-50b7-44d6-9209-ee881fc9b8b3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2OTE3NjMsIm5iZiI6MTczOTY5MTQ2MywicGF0aCI6Ii8zMzM4MjI4MC80MDkyODM1MDgtODIyNWU0ODUtNTBiNy00NGQ2LTkyMDktZWU4ODFmYzliOGIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE2VDA3Mzc0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIzNjdjNjFmOGU1ZmFkODRiYWQxMTQ4NjllOGU0MDUwNTI1MDQ1OWNmNDJmZTczNjFjODE3OTBjZDI4YzJlMjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.th4UJgCKLcjx_X3b8k3qdUhv5LxJfjzv8Oao4LLh5pY)
SET
("$BANKEY@minions"
), preventing minion retrieval. This is due to changes in how banks are referenced in thelist
function.The
![Image](https://private-user-images.githubusercontent.com/33382280/409283245-92498c64-de5f-4090-9529-10583c0c98c9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2OTE3NjMsIm5iZiI6MTczOTY5MTQ2MywicGF0aCI6Ii8zMzM4MjI4MC80MDkyODMyNDUtOTI0OThjNjQtZGU1Zi00MDkwLTk1MjktMTA1ODNjMGM5OGM5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE2VDA3Mzc0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMzMGQ5N2VjODA4MzkzMjBiYTE5YjgyYjdkNWE2OTc3MTg1MGJkOTk1ZjEyNTNmM2IzNTAyZGQxYjRhYjI0ZmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.o6w-_uTIFOzYQ3fXfl9wKhPFULofjusOjVZEUnr9HF8)
_build_bank_hier
function writes"."
as the value, causing the RedisSET
("$BANK@minions"
) to contain only"."
instead of the expected list of minions.According to SaltStack Documentation:
Setup
SaltMaster configuration:
SaltMinion configuration:
Please be as specific as possible and give set-up details.
Steps to Reproduce the behavior
Using the contents above for /etc/salt/master for salt-master and /etc/salt/minion for salt-minion run the following command so the minions "mine" and "data" is written to the redis cache:
Use mine.get targeting with grain or compound as the target type:
Expected behavior
The mine.get module to return back the mine data that matched the query:
Versions Report
salt --versions-report
Additional context
mine.get regression:
When either command:
Is ran the following is observed in redis/valkey:
The Redis SET queried should be "$BANK@minions" as "$BANKEY@minions" wouldn't even be an Redis SET to query based on the hierarchy that is built in redis: https://docs.saltproject.io/en/3007/ref/cache/all/salt.cache.redis_cache.html#redis
Reverting this line changed of the list function in redis_cache.py and restarting salt-master resolves the issue and the correct SET of "$BANK@minions" is then queried:
mine.update regression:
This is observed in redis/valkey when
salt 'salt-test' mine.update
is ran:The line in the redis output with the issue is:
[0 127.0.0.1:52616] "SADD" "$BANK@minions" "."
Which is inserted by this line of redis_cache.py
The salt-master debug logs for redis_cache.py inserting these items:
According to https://docs.saltproject.io/en/3007/ref/cache/all/salt.cache.redis_cache.html#redis:
"$BANK_*" is a Redis SET containing the list of banks under the current bank, rather than always being "."
Reverting the code in the "_build_bank_hier" function to the code in prior to the commit that caused the regression and restarting salt-master results in the following observed in redis/valkey when
salt 'salt-test' mine.update
is ran:"[0 127.0.0.1:50170] "SADD" "$BANK@minions" "salt-test""
Should be the expected result so that "$BANK@minions" is a Redis SET containing the list of banks.
The salt-master debug logs for redis_cache.py inserting these items:
After reverting both of these changes:
Restarting salt-master, running mine.update, and saltutil.refresh_grains so data is present in redis.
The expected data is then returned from mine.get using compound or grain targeting:
The text was updated successfully, but these errors were encountered: