'Replace registry\'s information about image membership.'

def replace_members(self, image_id, member_data):

    if isinstance(member_data, (list, tuple)):
        member_data = dict(memberships=list(member_data))
    elif (isinstance(member_data, dict) and ('memberships' not in member_data)):
        member_data = dict(memberships=[member_data])
    body = jsonutils.dump_as_bytes(member_data)
    headers = {'Content-Type': 'application/json'}
    res = self.do_request('PUT', ('/images/%s/members' % image_id), body=body, headers=headers)
    return (self.get_status_code(res) == 204)
