Merge "Ensure consistent encoding of strings for ID"

This commit is contained in:
Zuul 2018-10-08 12:03:09 +00:00 committed by Gerrit Code Review
commit fa152a1606
2 changed files with 5 additions and 5 deletions

View File

@ -160,10 +160,10 @@ class Etcd3Driver(coordination.CoordinationDriverCachedRunWatchers,
GROUP_PREFIX = b"tooz/groups/"
def _encode_group_id(self, group_id):
return self.GROUP_PREFIX + group_id + b"/"
return self.GROUP_PREFIX + utils.to_binary(group_id) + b"/"
def _encode_group_member_id(self, group_id, member_id):
return self._encode_group_id(group_id) + member_id
return self._encode_group_id(group_id) + utils.to_binary(member_id)
def create_group(self, group_id):
encoded_group = self._encode_group_id(group_id)

View File

@ -285,13 +285,13 @@ class MemcachedDriver(coordination.CoordinationDriverCachedRunWatchers,
self.client.close()
def _encode_group_id(self, group_id):
return self.GROUP_PREFIX + group_id
return self.GROUP_PREFIX + utils.to_binary(group_id)
def _encode_member_id(self, member_id):
return self.MEMBER_PREFIX + member_id
return self.MEMBER_PREFIX + utils.to_binary(member_id)
def _encode_group_leader(self, group_id):
return self.GROUP_LEADER_PREFIX + group_id
return self.GROUP_LEADER_PREFIX + utils.to_binary(group_id)
@_retry.retry()
def _add_group_to_group_list(self, group_id):