Open
Description
Describe the bug
this bug happend when I want to make connection to redis cluster with use TLS
To Reproduce
Steps to reproduce the behavior:
- here is my config on settings.py:
'redis-cluster-tls': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': 'rediss://:[email protected]',
'OPTIONS': {
'REDIS_CLIENT_CLASS': 'rediscluster.RedisCluster',
'CONNECTION_POOL_CLASS': 'rediscluster.connection.ClusterConnectionPool',
'CONNECTION_POOL_KWARGS': {
'skip_full_coverage_check': True,
'ssl': True,
},
"SOCKET_CONNECT_TIMEOUT": 20
"SOCKET_TIMEOUT": 20
},
"KEY_PREFIX": 'dev'
}
Expected behavior
it can get value and set to redis cluster with use TLS (Connection Type: OSS Cluster)
Stack trace
traceback: Traceback (most recent call last):
File "/Users/macbook2015/.local/share/virtualenvs/xxxxx-CWlIwagZ/lib/python3.9/site-packages/rediscluster/connection.py", line 364, in get_connection_by_node
connection = self._available_connections.get(node["name"], []).pop()
IndexError: pop from empty list
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/macbook2015/.local/share/virtualenvs/'-CWlIwagZ/lib/python3.9/site-packages/rediscluster/client.py", line 615, in _execute_command
connection = self.connection_pool.get_connection_by_node(node)
File "/Users/macbook2015/.local/share/virtualenvs/xxxxx-CWlIwagZ/lib/python3.9/site-packages/rediscluster/connection.py", line 366, in get_connection_by_node
connection = self.make_connection(node)
File "/Users/macbook2015/.local/share/virtualenvs/xxxxx-CWlIwagZ/lib/python3.9/site-packages/rediscluster/connection.py", line 273, in make_connection
connection = self.connection_class(host=node["host"], port=node["port"], **self.connection_kwargs)
File "/Users/macbook2015/.local/share/virtualenvs/xxxxx-CWlIwagZ/lib/python3.9/site-packages/redis/connection.py", line 828, in __init__
super(SSLConnection, self).__init__(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'ssl'
Environment (please complete the following information):
Python==3.9
Django==4.1.4
django-redis==5.2.0
redis==3.5.3
redis-py-cluster==2.1.3
additional context:
If I try some changes on redis-py package acctually its fixed the problem but can you guys help me to fix in django-redis instead of fix on redis-py
before:
class SSLConnection(Connection):
def __init__(self, ssl_keyfile=None, ssl_certfile=None,
ssl_cert_reqs='required', ssl_ca_certs=None,
ssl_check_hostname=False, **kwargs):
if not ssl_available:
raise RedisError("Python wasn't built with SSL support")
super(SSLConnection, self).__init__(**kwargs)
self.keyfile = ssl_keyfile
self.certfile = ssl_certfile
after:
class SSLConnection(Connection):
def __init__(self, ssl_keyfile=None, ssl_certfile=None,
ssl_cert_reqs='required', ssl_ca_certs=None,
ssl_check_hostname=False, **kwargs):
if not ssl_available:
raise RedisError("Python wasn't built with SSL support")
if 'ssl' in kwargs:
del kwargs['ssl']
super(SSLConnection, self).__init__(**kwargs)
self.keyfile = ssl_keyfile
self.certfile = ssl_certfile