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):
@@ -178,23 +178,27 @@ def _get_redis(config, dbid=None):
}
}
if 'sentinel' in config:
if 'sentinel' in config:
kwargs['socket_timeout'] = config['sentinel'].get(
sentinel_kwargs = {
'sentinel_socket_timeout', DEFAULT_SENTINEL_SOCKET_TIMEOUT)
'password': config['sentinel'].get('password'),
 
'socket_timeout': config['sentinel'].get(
 
'redis_socket_timeout', DEFAULT_REDIS_SENTINEL_TIMEOUT),
 
}
sentinel = redis.sentinel.Sentinel([(
sentinel = redis.sentinel.Sentinel([(
config['sentinel']['hostname'],
config['sentinel']['hostname'],
config['sentinel']['port'])],
config['sentinel']['port'])],
**kwargs)
**kwargs)
return sentinel.master_for(
return sentinel.master_for(
config['sentinel']['name'],
config['sentinel']['name'], **sentinel_kwargs)
socket_timeout=config['sentinel'].get(
'redis_socket_timeout', DEFAULT_REDIS_SENTINEL_TIMEOUT))
else:
else:
kwargs['socket_timeout'] = config['redis'].get(
redis_kwargs = {
'socket_timeout', DEFAULT_REDIS_SENTINEL_TIMEOUT)
'password': config['redis'].get('password'),
 
'socket_timeout': config['redis'].get(
 
'socket_timeout', DEFAULT_REDIS_SENTINEL_TIMEOUT),
 
}
return redis.StrictRedis(
return redis.StrictRedis(
host=config['redis']['hostname'],
host=config['redis']['hostname'],
port=config['redis']['port'],
port=config['redis']['port'],
**kwargs)
**redis_kwargs)
def get_current_redis(config):
def get_current_redis(config):
Loading