redis: Add username

Redis introduced ACL feature in 4.0.0, and this feature is supported by
redis-py since 3.4.0[1]. When ACL is enabled, authentication requires
username in addition to password.

[1] 8df8cd54d1

Change-Id: I9b53c3a314dcffbe49535799ba6d7a1fdddb8d84
This commit is contained in:
Takashi Kajinami 2024-02-04 15:10:10 +09:00
parent 22361cb48d
commit 886323cc05
2 changed files with 5 additions and 2 deletions

View File

@ -53,7 +53,7 @@ etcd3gw =
zake =
zake>=0.1.6 # Apache-2.0
redis =
redis>=3.1.0 # MIT
redis>=3.4.0 # MIT
postgresql =
psycopg2>=2.5 # LGPL/ZPL
mysql =

View File

@ -159,7 +159,8 @@ class RedisDriver(coordination.CoordinationDriverCachedRunWatchers,
The Redis driver connection URI should look like::
redis://[:PASSWORD@]HOST:PORT[?OPTION=VALUE[&OPTION2=VALUE2[&...]]]
redis://[USERNAME:PASSWORD@]HOST:PORT
[?OPTION=VALUE[&OPTION2=VALUE2[&...]]]
For a list of options recognized by this driver, see the documentation
for the member CLIENT_ARGS, and to determine the expected types of those
@ -428,6 +429,8 @@ return 1
if not parsed_url.path:
raise ValueError("Expected socket path in parsed urls path")
kwargs['unix_socket_path'] = parsed_url.path
if parsed_url.username:
kwargs['username'] = parsed_url.username
if parsed_url.password:
kwargs['password'] = parsed_url.password
for a in cls.CLIENT_ARGS: