Skip to content

Commit c2d207b

Browse files
committed
Linter check pass
1 parent 2746dcd commit c2d207b

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* Fixed sentinel execute command response
12
* Allow to control the minimum SSL version
23
* Add an optional lock_name attribute to LockError.
34
* Fix return types for `get`, `set_path` and `strappend` in JSONCommands

redis/asyncio/sentinel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,15 @@ async def execute_command(self, *args, **kwargs):
228228
once = bool(kwargs.get("once", False))
229229
if "once" in kwargs.keys():
230230
kwargs.pop("once")
231-
231+
232232
# Check if command suppose to return boolean response.
233233
bool_resp = bool(kwargs.get("bool_resp", False))
234234
if "bool_resp" in kwargs.keys():
235235
kwargs.pop("bool_resp")
236236

237237
if once:
238238
return await random.choice(self.sentinels).execute_command(*args, **kwargs)
239-
239+
240240
tasks = [
241241
asyncio.Task(sentinel.execute_command(*args, **kwargs))
242242
for sentinel in self.sentinels
@@ -245,7 +245,7 @@ async def execute_command(self, *args, **kwargs):
245245

246246
if bool_resp:
247247
return reduce(lambda x, y: x and y, responses)
248-
248+
249249
return responses
250250

251251
def __repr__(self):

redis/commands/sentinel.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ def sentinel(self, *args):
1313

1414
def sentinel_get_master_addr_by_name(self, service_name):
1515
"""Returns a (host, port) pair for the given ``service_name``"""
16-
return self.execute_command("SENTINEL GET-MASTER-ADDR-BY-NAME", service_name, once=True)
16+
return self.execute_command(
17+
"SENTINEL GET-MASTER-ADDR-BY-NAME", service_name, once=True
18+
)
1719

1820
def sentinel_master(self, service_name):
1921
"""Returns a dictionary containing the specified masters state."""
@@ -25,7 +27,9 @@ def sentinel_masters(self):
2527

2628
def sentinel_monitor(self, name, ip, port, quorum):
2729
"""Add a new master to Sentinel to be monitored"""
28-
return self.execute_command("SENTINEL MONITOR", name, ip, port, quorum, bool_resp=True)
30+
return self.execute_command(
31+
"SENTINEL MONITOR", name, ip, port, quorum, bool_resp=True
32+
)
2933

3034
def sentinel_remove(self, name):
3135
"""Remove a master from Sentinel's monitoring"""
@@ -52,7 +56,9 @@ def sentinel_reset(self, pattern):
5256
failover in progress), and removes every slave and sentinel already
5357
discovered and associated with the master.
5458
"""
55-
return self.execute_command("SENTINEL RESET", pattern, once=True, bool_resp=True)
59+
return self.execute_command(
60+
"SENTINEL RESET", pattern, once=True, bool_resp=True
61+
)
5662

5763
def sentinel_failover(self, new_master_name):
5864
"""
@@ -61,7 +67,9 @@ def sentinel_failover(self, new_master_name):
6167
configuration will be published so that the other Sentinels will
6268
update their configurations).
6369
"""
64-
return self.execute_command("SENTINEL FAILOVER", new_master_name, bool_resp=True)
70+
return self.execute_command(
71+
"SENTINEL FAILOVER", new_master_name, bool_resp=True
72+
)
6573

6674
def sentinel_ckquorum(self, new_master_name):
6775
"""
@@ -72,7 +80,9 @@ def sentinel_ckquorum(self, new_master_name):
7280
This command should be used in monitoring systems to check if a
7381
Sentinel deployment is ok.
7482
"""
75-
return self.execute_command("SENTINEL CKQUORUM", new_master_name, once=True, bool_resp=True)
83+
return self.execute_command(
84+
"SENTINEL CKQUORUM", new_master_name, once=True, bool_resp=True
85+
)
7686

7787
def sentinel_flushconfig(self):
7888
"""

redis/sentinel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def execute_command(self, *args, **kwargs):
255255
once = bool(kwargs.get("once", False))
256256
if "once" in kwargs.keys():
257257
kwargs.pop("once")
258-
258+
259259
# Check if command suppose to return boolean response.
260260
bool_resp = bool(kwargs.get("bool_resp", False))
261261
if "bool_resp" in kwargs.keys():
@@ -267,10 +267,10 @@ def execute_command(self, *args, **kwargs):
267267
responses = []
268268
for sentinel in self.sentinels:
269269
responses.append(sentinel.execute_command(*args, **kwargs))
270-
270+
271271
if bool_resp:
272272
return reduce(lambda x, y: x and y, responses)
273-
273+
274274
return responses
275275

276276
def __repr__(self):

0 commit comments

Comments
 (0)