mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #49190 from The-Loeki/redis-fix
decode_reponses=True on all Redis API interfaces
This commit is contained in:
commit
d29af008da
5 changed files with 7 additions and 7 deletions
3
salt/cache/redis_cache.py
vendored
3
salt/cache/redis_cache.py
vendored
|
@ -231,8 +231,7 @@ def _get_redis_server(opts=None):
|
|||
|
||||
if opts['cluster_mode']:
|
||||
REDIS_SERVER = StrictRedisCluster(startup_nodes=opts['startup_nodes'],
|
||||
skip_full_coverage_check=opts['skip_full_coverage_check'],
|
||||
decode_responses=True)
|
||||
skip_full_coverage_check=opts['skip_full_coverage_check'])
|
||||
else:
|
||||
REDIS_SERVER = redis.StrictRedis(opts['host'],
|
||||
opts['port'],
|
||||
|
|
|
@ -63,7 +63,7 @@ class Listener(object):
|
|||
tag = 'salt/engine/redis_sentinel'
|
||||
super(Listener, self).__init__()
|
||||
self.tag = tag
|
||||
self.redis = redis.StrictRedis(host=host, port=port)
|
||||
self.redis = redis.StrictRedis(host=host, port=port, decode_responses=True)
|
||||
self.pubsub = self.redis.pubsub()
|
||||
self.pubsub.psubscribe(channels)
|
||||
self.fire_master = salt.utils.event.get_master_event(__opts__, __opts__['sock_dir']).fire_event
|
||||
|
|
|
@ -55,7 +55,7 @@ def _connect(host=None, port=None, db=None, password=None):
|
|||
if not password:
|
||||
password = __salt__['config.option']('redis.password')
|
||||
|
||||
return redis.StrictRedis(host, port, db, password)
|
||||
return redis.StrictRedis(host, port, db, password, decode_responses=True)
|
||||
|
||||
|
||||
def _sconnect(host=None, port=None, password=None):
|
||||
|
@ -69,7 +69,7 @@ def _sconnect(host=None, port=None, password=None):
|
|||
if password is None:
|
||||
password = __salt__['config.option']('redis_sentinel.password')
|
||||
|
||||
return redis.StrictRedis(host, port, password=password)
|
||||
return redis.StrictRedis(host, port, password=password, decode_responses=True)
|
||||
|
||||
|
||||
def bgrewriteaof(host=None, port=None, db=None, password=None):
|
||||
|
|
|
@ -188,7 +188,8 @@ def _get_serv(ret=None):
|
|||
REDIS_POOL = redis.StrictRedis(host=_options.get('host'),
|
||||
port=_options.get('port'),
|
||||
unix_socket_path=_options.get('unix_socket_path', None),
|
||||
db=_options.get('db'))
|
||||
db=_options.get('db'),
|
||||
decode_responses=True)
|
||||
return REDIS_POOL
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ def _redis_client(opts):
|
|||
redis_host = opts.get("eauth_redis_host", "localhost")
|
||||
redis_port = opts.get("eauth_redis_port", 6379)
|
||||
try:
|
||||
return rediscluster.StrictRedisCluster(host=redis_host, port=redis_port)
|
||||
return rediscluster.StrictRedisCluster(host=redis_host, port=redis_port, decode_responses=True)
|
||||
except rediscluster.exceptions.RedisClusterException as err:
|
||||
log.warning(
|
||||
'Failed to connect to redis at %s:%s - %s',
|
||||
|
|
Loading…
Add table
Reference in a new issue