partitioner: do not use hash() to determine object identity

The `hash` method is random on Python 3, so it's not consistent between. Just
use the string representation of the object as a default.

Change-Id: I84e2b19b64dc1641f9758429248dc6b928122b18
Closes-Bug: #1743243
This commit is contained in:
Julien Danjou 2018-01-18 11:28:23 +01:00
parent 78caecd878
commit 62fd552e1e

View File

@ -53,7 +53,7 @@ class Partitioner(object):
def _hash_object(obj):
if hasattr(obj, "__tooz_hash__"):
return obj.__tooz_hash__()
return str(hash(obj)).encode('ascii')
return str(obj).encode()
def members_for_object(self, obj, ignore_members=None, replicas=1):
"""Return the members responsible for an object.