Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

take care of invalid redis servers params

  • Loading branch information...
commit 7bd7c60936603e668c985614dff0f68833dca656 1 parent 73dbef1
@salimane authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  rediscluster/cluster_client.py
View
3  rediscluster/cluster_client.py
@@ -91,6 +91,7 @@ def __init__(self, cluster={}, db=0):
self.redises = {}
#connect to all servers
for alias, server in iteritems(cluster['nodes']):
+ info = {}
try:
self.__redis = redis.StrictRedis(db=db, **server)
info = self.__redis.info()
@@ -101,7 +102,7 @@ def __init__(self, cluster={}, db=0):
#if node is slave and is down, replace its connection with its master's
try:
ms = [k for k, v in iteritems(cluster['master_of'])
- if v == alias and (info['role'] == 'slave' or cluster['nodes'][k] == cluster['nodes'][v])][0]
+ if v == alias and (('role' in info and info['role'] == 'slave') or cluster['nodes'][k] == cluster['nodes'][v])][0]
except IndexError:
ms = None
Please sign in to comment.
Something went wrong with that request. Please try again.