Skip to content
Snippets Groups Projects

Added redis auth credentials to inventory config schema and updated _get_redis wrapper.

Merged Neda Moeini requested to merge feature/DBOARD3-747 into develop
3 files
+ 76
8
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -178,23 +178,27 @@ def _get_redis(config, dbid=None):
}
if 'sentinel' in config:
kwargs['socket_timeout'] = config['sentinel'].get(
'sentinel_socket_timeout', DEFAULT_SENTINEL_SOCKET_TIMEOUT)
sentinel_kwargs = {
'password': config['sentinel'].get('password'),
'socket_timeout': config['sentinel'].get(
'redis_socket_timeout', DEFAULT_REDIS_SENTINEL_TIMEOUT),
}
sentinel = redis.sentinel.Sentinel([(
config['sentinel']['hostname'],
config['sentinel']['port'])],
**kwargs)
return sentinel.master_for(
config['sentinel']['name'],
socket_timeout=config['sentinel'].get(
'redis_socket_timeout', DEFAULT_REDIS_SENTINEL_TIMEOUT))
config['sentinel']['name'], **sentinel_kwargs)
else:
kwargs['socket_timeout'] = config['redis'].get(
'socket_timeout', DEFAULT_REDIS_SENTINEL_TIMEOUT)
redis_kwargs = {
'password': config['redis'].get('password'),
'socket_timeout': config['redis'].get(
'socket_timeout', DEFAULT_REDIS_SENTINEL_TIMEOUT),
}
return redis.StrictRedis(
host=config['redis']['hostname'],
port=config['redis']['port'],
**kwargs)
**redis_kwargs)
def get_current_redis(config):
Loading