From 2b2398b712cedc8148b896ddf795c27241e462b0 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 28 Nov 2012 15:19:49 -0500 Subject: [PATCH] zephyr_mirror: Pass an encoded stream to hashlib for sharding. (imported from commit cc57b3956198b66c9cfc84423434a71b8200d819) --- bots/zephyr_mirror_backend.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index 2920733..414524d 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -185,6 +185,7 @@ def update_subscriptions_from_humbug(): return streams_to_subscribe = [] for stream in streams: + encoded_stream = stream.encode("utf-8") if stream in current_zephyr_subs: continue if stream in ['security', 'login', 'network']: @@ -192,11 +193,11 @@ def update_subscriptions_from_humbug(): # to MIT's Zephyr access control settings continue if (options.shard is not None and - not hashlib.sha1(stream).hexdigest().startswith(options.shard)): + not hashlib.sha1(encoded_stream).hexdigest().startswith(options.shard)): # This stream is being handled by a different zephyr_mirror job. continue - streams_to_subscribe.append((stream.encode("utf-8"), "*", "*")) + streams_to_subscribe.append((encoded_stream, "*", "*")) if len(streams_to_subscribe) > 0: zephyr_bulk_subscribe(streams_to_subscribe)