From 613d3db8e0393d98ba4524884bf2927fc7bbd179 Mon Sep 17 00:00:00 2001 From: jason Date: Sat, 3 Feb 2018 02:35:34 +0800 Subject: [PATCH] Fixbug init failed useing aws ssl cluster (#70) * fixbug: initiation error of aws cluster client caused by not appropiate function list used * fix bug: use `ssl_context` instead of ssl_keyfile,ssl_certfile,ssl_cert_reqs,ssl_ca_certs in intialization of connection_pool --- aredis/client.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/aredis/client.py b/aredis/client.py index b9c7dba4..f9e55c4f 100644 --- a/aredis/client.py +++ b/aredis/client.py @@ -18,7 +18,7 @@ from aredis.commands.sorted_set import SortedSetCommandMixin, ClusterSortedSetCommandMixin from aredis.commands.strings import StringsCommandMixin, ClusterStringsCommandMixin from aredis.commands.transaction import TransactionCommandMixin, ClusterTransactionCommandMixin -from aredis.connection import UnixDomainSocketConnection +from aredis.connection import UnixDomainSocketConnection, RedisSSLContext from aredis.exceptions import ( ConnectionError, TimeoutError, RedisClusterException, MovedError, @@ -108,7 +108,7 @@ def __init__(self, host='localhost', port=6379, ssl_keyfile=None, ssl_certfile=None, ssl_cert_reqs=None, ssl_ca_certs=None, max_connections=None, retry_on_timeout=False, - *, loop=None): + loop=None, **kwargs): if not connection_pool: kwargs = { 'db': db, @@ -135,12 +135,8 @@ def __init__(self, host='localhost', port=6379, }) if ssl: - kwargs.update({ - 'ssl_keyfile': ssl_keyfile, - 'ssl_certfile': ssl_certfile, - 'ssl_cert_reqs': ssl_cert_reqs, - 'ssl_ca_certs': ssl_ca_certs, - }) + ssl_context = RedisSSLContext(ssl_keyfile, ssl_certfile, ssl_cert_reqs, ssl_ca_certs).get() + kwargs['ssl_context'] = ssl_context connection_pool = ConnectionPool(**kwargs) self.connection_pool = connection_pool self._use_lua_lock = None