Repository navigation
Add backend for Redis Sentinel - #1
MatusJenca2 wants to merge 1 commit into
Conversation
fdobrovolny
left a comment
There was a problem hiding this comment.
LGTM, excellent work. PEP8 formatting would be nice, and I added a few comments.
| default=60, | ||
| help='Time in seconds before attempting to add a node ' | ||
| 'back in the pool in the HashClient\'s internal mechanisms.'), | ||
| 'back in the pool in the HashClient\'s internal mechanisms.') |
There was a problem hiding this comment.
| 'back in the pool in the HashClient\'s internal mechanisms.') | |
| 'back in the pool in the HashClient\'s internal mechanisms.'), |
Extra change
| conf_dict['%s.arguments.dead_timeout' % prefix] = \ | ||
| conf.cache.dead_timeout | ||
|
|
||
| """ | ||
| del arguments['username'] | ||
| del arguments['password'] | ||
| return super(RedisSentinelTLSBackend, self).__init__(arguments) No newline at end of file |
There was a problem hiding this comment.
| return super(RedisSentinelTLSBackend, self).__init__(arguments) | |
| return super(RedisSentinelTLSBackend, self).__init__(arguments) | |
Newline at the end of file.
| username=arguments['username'], | ||
| password=arguments['password'] |
There was a problem hiding this comment.
| username=arguments['username'], | |
| password=arguments['password'] | |
| username=arguments['username'], | |
| password=arguments['password'] |
Incorrect padding.
| __all__ = [ | ||
| 'RedisSentinelTLSBackend' | ||
| ] | ||
| class RedisSentinelTLSBackend(redis_backend.RedisSentinelBackend): |
There was a problem hiding this comment.
| class RedisSentinelTLSBackend(redis_backend.RedisSentinelBackend): | |
| class RedisSentinelTLSBackend(redis_backend.RedisSentinelBackend): |
| connection_kwargs=reformated_kwargs, | ||
| sentinel_kwargs=reformated_kwargs | ||
| ) | ||
| """ |
There was a problem hiding this comment.
| """ | |
| """ |
I would probably add a blank line here as well.
| because user is unable to pass them using oslo config in it's current format | ||
| arguments: | ||
| sentinels: list of sentinels formated as sentinel1IP:port,sentinel2IP:port | ||
| ssl: turns on TLS |
There was a problem hiding this comment.
Is ssl a bool or a dict or something of extra options?
| ssl: turns on TLS | ||
| ssl-<keyfile,certfile,ca_certs>: TLS certificate, key and CA | ||
| username,password: login credentials | ||
| """ |
There was a problem hiding this comment.
You should probably rewrite the docstring to be in Google docstring format so it is consistent with other backends already in oslo:
oslo.cache/oslo_cache/backends/mongo.py
Lines 40 to 155 in 17b2fdb
| # This removes username and password that are needed for redis_sentinel backend | ||
| if conf.cache.backend != "oslo_cache.redis_sentinel": | ||
| for arg in ('dead_retry', 'socket_timeout', 'pool_maxsize', | ||
| 'pool_unused_timeout', 'pool_connection_get_timeout', | ||
| 'pool_flush_on_reconnect', 'sasl_enabled', 'username', | ||
| 'password'): | ||
| value = getattr(conf.cache, 'memcache_' + arg) | ||
| conf_dict['%s.arguments.%s' % (prefix, arg)] = value |
There was a problem hiding this comment.
🤔 This may be an area where upstream will request a change. I suggest including line 162 as well. But I have to think about this bit more if there is a better way to achieve this 🤔
| """ | ||
| Usename and password must be deleted from arguments dict | ||
| after being added to connection_kwargs, otherwise there | ||
| will be AUTH error | ||
| """ |
There was a problem hiding this comment.
In the core.py, they use # for multiline comment inside function. I would probably consider using that here, too.
be2908e to
c523383
Compare
Signed-off-by: Matus Jenca <[email protected]>
c523383 to
d8f20d6
Compare
Just for internal review before upstream PR in openstack gerrit repo.