Open cheald opened 5 years ago
https://github.com/saltstack/salt/commit/7ff72eb01fdd4645d68a813fd3f4bac024f42b0c is the commit that broke it. It appears that reinstating decode_responses=True
fixes the cache fetch. However, it may be that this breaks the retrieval of the actual cache values (which should be binary msgpack strings, rather than UTF-8).
Manually decoding the list in cache.list seems to be closer to the right fix:
def list_(bank):
'''
Lists entries stored in the specified bank.
'''
redis_server = _get_redis_server()
bank_redis_key = _get_bank_redis_key(bank)
try:
- banks = redis_server.smembers(bank_redis_key)
+ banks = [bank.decode("utf-8") for bank in redis_server.smembers(bank_redis_key)]
except (RedisConnectionError, RedisResponseError) as rerr:
mesg = 'Cannot list the Redis cache key {rkey}: {rerr}'.format(rkey=bank_redis_key,
rerr=rerr)
We only ever sadd keys. Redis does permit binary keys, but since we're never doing any encoding on the keys themselves, I suspect it should be safe enough to interpret them as UTF-8 on the way back out.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
This issue is still outstanding and should not be stale.
Thank you for updating this issue. It is no longer marked as stale.
This is still an issue and the proposed fix works.
Description of Issue
Using the redis cache module on Python 3 fails to ever return any cached data. Data is written with
"SET" "$KEY_minions/minionname/data"
, but it is then attempted to be read with"GET" "$KEY_minions/b'minionname'/data"
.Setup
Just set
cache: redis
and install a local redis server.Steps to Reproduce Issue
monitor
.b''
salt someminion pillar.update
. Watch it set the cache without the b''.Versions Report