@@ -14,38 +14,55 @@ def sentinel(self, *args):
14
14
def sentinel_get_master_addr_by_name (self , service_name ):
15
15
"""Returns a (host, port) pair for the given ``service_name``"""
16
16
return self .execute_command (
17
- "SENTINEL GET-MASTER-ADDR-BY-NAME" , service_name , once = True
17
+ "SENTINEL GET-MASTER-ADDR-BY-NAME" ,
18
+ service_name ,
19
+ once = True ,
20
+ return_responses = True ,
18
21
)
19
22
20
23
def sentinel_master (self , service_name ):
21
24
"""Returns a dictionary containing the specified masters state."""
22
- return self .execute_command ("SENTINEL MASTER" , service_name )
25
+ return self .execute_command (
26
+ "SENTINEL MASTER" , service_name , return_responses = True
27
+ )
23
28
24
29
def sentinel_masters (self ):
25
- """Returns a list of dictionaries containing each master's state."""
26
- return self .execute_command ("SENTINEL MASTERS" , once = True )
30
+ """
31
+ Returns a list of dictionaries containing each master's state.
32
+
33
+ Important: This function is called by the Sentinel implementation and is
34
+ called directly on the Redis standalone client for sentinels,
35
+ so it doesn'tsupport the "once" and "return_responses" options.
36
+ """
37
+ return self .execute_command ("SENTINEL MASTERS" )
27
38
28
39
def sentinel_monitor (self , name , ip , port , quorum ):
29
40
"""Add a new master to Sentinel to be monitored"""
30
- return self .execute_command (
31
- "SENTINEL MONITOR" , name , ip , port , quorum , bool_resp = True
32
- )
41
+ return self .execute_command ("SENTINEL MONITOR" , name , ip , port , quorum )
33
42
34
43
def sentinel_remove (self , name ):
35
44
"""Remove a master from Sentinel's monitoring"""
36
- return self .execute_command ("SENTINEL REMOVE" , name , bool_resp = True )
45
+ return self .execute_command ("SENTINEL REMOVE" , name )
37
46
38
47
def sentinel_sentinels (self , service_name ):
39
48
"""Returns a list of sentinels for ``service_name``"""
40
- return self .execute_command ("SENTINEL SENTINELS" , service_name )
49
+ return self .execute_command (
50
+ "SENTINEL SENTINELS" , service_name , return_responses = True
51
+ )
41
52
42
53
def sentinel_set (self , name , option , value ):
43
54
"""Set Sentinel monitoring parameters for a given master"""
44
- return self .execute_command ("SENTINEL SET" , name , option , value , bool_resp = True )
55
+ return self .execute_command ("SENTINEL SET" , name , option , value )
45
56
46
57
def sentinel_slaves (self , service_name ):
47
- """Returns a list of slaves for ``service_name``"""
48
- return self .execute_command ("SENTINEL SLAVES" , service_name , once = True )
58
+ """
59
+ Returns a list of slaves for ``service_name``
60
+
61
+ Important: This function is called by the Sentinel implementation and is
62
+ called directly on the Redis standalone client for sentinels,
63
+ so it doesn'tsupport the "once" and "return_responses" options.
64
+ """
65
+ return self .execute_command ("SENTINEL SLAVES" , service_name )
49
66
50
67
def sentinel_reset (self , pattern ):
51
68
"""
@@ -56,9 +73,7 @@ def sentinel_reset(self, pattern):
56
73
failover in progress), and removes every slave and sentinel already
57
74
discovered and associated with the master.
58
75
"""
59
- return self .execute_command (
60
- "SENTINEL RESET" , pattern , once = True , bool_resp = True
61
- )
76
+ return self .execute_command ("SENTINEL RESET" , pattern , once = True )
62
77
63
78
def sentinel_failover (self , new_master_name ):
64
79
"""
@@ -67,9 +82,7 @@ def sentinel_failover(self, new_master_name):
67
82
configuration will be published so that the other Sentinels will
68
83
update their configurations).
69
84
"""
70
- return self .execute_command (
71
- "SENTINEL FAILOVER" , new_master_name , bool_resp = True
72
- )
85
+ return self .execute_command ("SENTINEL FAILOVER" , new_master_name )
73
86
74
87
def sentinel_ckquorum (self , new_master_name ):
75
88
"""
@@ -80,9 +93,7 @@ def sentinel_ckquorum(self, new_master_name):
80
93
This command should be used in monitoring systems to check if a
81
94
Sentinel deployment is ok.
82
95
"""
83
- return self .execute_command (
84
- "SENTINEL CKQUORUM" , new_master_name , once = True , bool_resp = True
85
- )
96
+ return self .execute_command ("SENTINEL CKQUORUM" , new_master_name , once = True )
86
97
87
98
def sentinel_flushconfig (self ):
88
99
"""
@@ -100,7 +111,7 @@ def sentinel_flushconfig(self):
100
111
This command works even if the previous configuration file is
101
112
completely missing.
102
113
"""
103
- return self .execute_command ("SENTINEL FLUSHCONFIG" , bool_resp = True )
114
+ return self .execute_command ("SENTINEL FLUSHCONFIG" )
104
115
105
116
106
117
class AsyncSentinelCommands (SentinelCommands ):
0 commit comments