@@ -29,7 +29,7 @@ def __init__(self, url, database, convention=None, api_key=None, force_get_topol
29
29
self .convention = convention
30
30
if self .convention is None :
31
31
self .convention = DocumentConvention ()
32
- self .headers = {"Accept" : "application/json" , "Has-Api-key" : True if self .api_key is not None else False ,
32
+ self .headers = {"Accept" : "application/json" , "Has-Api-key" : 'true' if self .api_key is not None else 'false' ,
33
33
"Raven-Client-Version" : "3.0.0.0" }
34
34
self .replication_topology = IndexQueue ()
35
35
self .topology_change_counter = 0
@@ -186,10 +186,7 @@ def update_replication(self, topology_file):
186
186
with open (topology_file , 'w+' ) as f :
187
187
f .write (json .dumps (self .topology ))
188
188
self .replication_topology .queue .clear ()
189
- for destination in self .topology ["Destinations" ]:
190
- self .replication_topology .put ({"url" : destination ["Url" ], "database" : destination ["Database" ],
191
- "credentials" : {"api_key" : destination ["ApiKey" ],
192
- "domain" : destination ["Domain" ]}})
189
+ self ._load_topology ()
193
190
194
191
def check_replication_change (self , topology_file ):
195
192
@@ -220,15 +217,19 @@ def get_replication_topology(self):
220
217
try :
221
218
with open (topology_file , 'r' ) as f :
222
219
self .topology = json .loads (f .read ())
223
- for destination in self .topology ["Destinations" ]:
224
- self .replication_topology .put ({"url" : destination ["Url" ], "database" : destination ["Database" ],
225
- "credentials" : {"api_key" : destination ["ApiKey" ],
226
- "domain" : destination ["Domain" ]}})
220
+ self ._load_topology ()
227
221
except IOError :
228
222
pass
229
223
230
224
self .check_replication_change (topology_file )
231
225
226
+ def _load_topology (self ):
227
+ for destination in self .topology ["Destinations" ]:
228
+ if not destination ["Disabled" ] and not destination ["IgnoredClient" ]:
229
+ self .replication_topology .put ({"url" : destination ["Url" ], "database" : destination ["Database" ],
230
+ "credentials" : {"api_key" : destination ["ApiKey" ],
231
+ "domain" : destination ["Domain" ]}})
232
+
232
233
def do_auth_request (self , api_key , oauth_source , second_api_key = None ):
233
234
api_name , secret = api_key .split ('/' , 1 )
234
235
tries = 1
0 commit comments