Grokzen / redis-py-cluster

Python cluster client for the official redis cluster. Redis 3.0+.
https://redis-py-cluster.readthedocs.io/
MIT License
1.1k stars 316 forks source link

CLUSTER FAILOVER implementation requires optional parameter #437

Closed mmllc-jsilverman closed 3 years ago

mmllc-jsilverman commented 3 years ago

The actual redis command CLUSTER FAILOVER requires no additional parameters. There is an optional param that can be of the value "FORCE" or "TAKEOVER" redis-py-cluster asserts that these optional parameters are mandatory and I get an error unless I use one.

Example call:

node_id="4a40570ca18d489691f68be337e79c80"
rc.cluster_failover(node_id,"")    # I tried to use an empty optional value

Resulting error:

File "/usr/local/lib/python3.6/site-packages/rediscluster/client.py", line 802, in cluster_failover
  assert option.upper() in ('FORCE', 'TAKEOVER')  # TODO: change this option handling
AssertionError

According to Redis cluster docs, the parameter is optional: https://redis.io/commands/cluster-failover

Grokzen commented 3 years ago

@mmllc-jsilverman Fixed in https://github.com/Grokzen/redis-py-cluster/commit/96f2172eb737abf82e73c6bef1205c0fc7e5e4ba