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

decode_reponses=True on all Redis API interfaces #49190

Merged
merged 3 commits into from Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions salt/cache/redis_cache.py
Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion salt/engines/redis_sentinel.py
Expand Up @@ -63,7 +63,7 @@ def __init__(self, host=None, port=None, channels=None, tag=None):
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
Expand Down
4 changes: 2 additions & 2 deletions salt/modules/redismod.py
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion salt/returners/redis_return.py
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion salt/tokens/rediscluster.py
Expand Up @@ -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',
Expand Down