From cc53f44c7e3ce900ab6e8d75744e835e79e14afe Mon Sep 17 00:00:00 2001 From: Gabriel Tincu Date: Mon, 27 Apr 2020 22:18:25 +0200 Subject: [PATCH] Do not use newly created ACL request / responses in allowed version lists, due to flexible versions enabling in kafka actually requiring a serialization protocol update --- kafka/admin/client.py | 4 ++-- kafka/conn.py | 4 ++-- kafka/protocol/admin.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kafka/admin/client.py b/kafka/admin/client.py index d0fa84560..f9b97ba0e 100644 --- a/kafka/admin/client.py +++ b/kafka/admin/client.py @@ -570,7 +570,7 @@ def describe_acls(self, acl_filter): operation=acl_filter.operation, permission_type=acl_filter.permission_type ) - elif version <= 1: + elif version <= 2: request = DescribeAclsRequest[version]( resource_type=acl_filter.resource_pattern.resource_type, resource_name=acl_filter.resource_pattern.resource_name, @@ -763,7 +763,7 @@ def delete_acls(self, acl_filters): request = DeleteAclsRequest[version]( filters=[self._convert_delete_acls_resource_request_v0(acl) for acl in acl_filters] ) - elif version <= 1: + elif version <= 2: request = DeleteAclsRequest[version]( filters=[self._convert_delete_acls_resource_request_v1(acl) for acl in acl_filters] ) diff --git a/kafka/conn.py b/kafka/conn.py index 131fb97ec..5c7287568 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -24,7 +24,7 @@ from kafka.future import Future from kafka.metrics.stats import Avg, Count, Max, Rate from kafka.oauth.abstract import AbstractTokenProvider -from kafka.protocol.admin import SaslHandShakeRequest, DescribeAclsRequest +from kafka.protocol.admin import SaslHandShakeRequest, DescribeAclsRequest_v2 from kafka.protocol.commit import OffsetFetchRequest from kafka.protocol.offset import OffsetRequest from kafka.protocol.produce import ProduceRequest @@ -1169,7 +1169,7 @@ def _infer_broker_version_from_api_versions(self, api_versions): # in reverse order. As soon as we find one that works, return it test_cases = [ # format (, ) - ((2, 5, 0), DescribeAclsRequest[2]), + ((2, 5, 0), DescribeAclsRequest_v2), ((2, 4, 0), ProduceRequest[8]), ((2, 3, 0), FetchRequest[11]), ((2, 2, 0), OffsetRequest[5]), diff --git a/kafka/protocol/admin.py b/kafka/protocol/admin.py index 1d3900737..af88ea473 100644 --- a/kafka/protocol/admin.py +++ b/kafka/protocol/admin.py @@ -523,8 +523,8 @@ class DescribeAclsRequest_v2(Request): SCHEMA = DescribeAclsRequest_v1.SCHEMA -DescribeAclsRequest = [DescribeAclsRequest_v0, DescribeAclsRequest_v1, DescribeAclsRequest_v2] -DescribeAclsResponse = [DescribeAclsResponse_v0, DescribeAclsResponse_v1, DescribeAclsResponse_v2] +DescribeAclsRequest = [DescribeAclsRequest_v0, DescribeAclsRequest_v1] +DescribeAclsResponse = [DescribeAclsResponse_v0, DescribeAclsResponse_v1] class CreateAclsResponse_v0(Response): API_KEY = 30