@@ -75,15 +75,13 @@ struct Admin_options {
75
75
float request_timeout ; /* parser: f */
76
76
float operation_timeout ; /* parser: f */
77
77
int broker ; /* parser: i */
78
- int incremental ; /* needs special bool parsing */
79
78
};
80
79
81
80
/**@brief "unset" value initializers for Admin_options
82
81
* Make sure this is kept up to date with Admin_options above. */
83
82
#define Admin_options_INITIALIZER { \
84
83
Admin_options_def_int, Admin_options_def_float, \
85
84
Admin_options_def_float, Admin_options_def_int, \
86
- Admin_options_def_int, \
87
85
}
88
86
89
87
#define Admin_options_is_set_int (v ) ((v) != Admin_options_def_int)
@@ -143,12 +141,6 @@ Admin_options_to_c (Handle *self, rd_kafka_admin_op_t for_api,
143
141
errstr , sizeof (errstr ))))
144
142
goto err ;
145
143
146
- if (Admin_options_is_set_int (options -> incremental ) &&
147
- (err = rd_kafka_AdminOptions_set_incremental (
148
- c_options , options -> incremental ,
149
- errstr , sizeof (errstr ))))
150
- goto err ;
151
-
152
144
return c_options ;
153
145
154
146
err :
@@ -250,7 +242,7 @@ static int Admin_set_replica_assignment (const char *forApi, void *c_obj,
250
242
}
251
243
252
244
/**
253
- * @brief Translate a dict to ConfigResource {set,add,delete}_config () calls,
245
+ * @brief Translate a dict to ConfigResource set_config () calls,
254
246
* or to NewTopic_add_config() calls.
255
247
*
256
248
*
@@ -276,52 +268,44 @@ Admin_config_dict_to_c (void *c_obj, PyObject *dict, const char *op_name) {
276
268
277
269
k = cfl_PyUnistr_AsUTF8 (ks , & ks8 );
278
270
279
- if (!strcmp (op_name , "del_config" )) {
280
- err = rd_kafka_ConfigResource_delete_config (
281
- (rd_kafka_ConfigResource_t * )c_obj , k );
282
- } else {
283
- PyObject * vs = NULL , * vs8 = NULL ;
284
- if (!(vs = cfl_PyObject_Unistr (vo )) ||
285
- !(v = cfl_PyUnistr_AsUTF8 (vs , & vs8 ))) {
286
- PyErr_Format (PyExc_ValueError ,
287
- "expect %s config value for %s "
288
- "to be unicode string" ,
289
- op_name , k );
290
- Py_XDECREF (vs );
291
- Py_XDECREF (vs8 );
292
- Py_DECREF (ks );
293
- Py_XDECREF (ks8 );
294
- return 0 ;
295
- }
296
271
297
- if (!strcmp (op_name , "add_config" ))
298
- err = rd_kafka_ConfigResource_add_config (
299
- (rd_kafka_ConfigResource_t * )c_obj ,
300
- k , v );
301
- else if (!strcmp (op_name , "set_config" ))
302
- err = rd_kafka_ConfigResource_set_config (
303
- (rd_kafka_ConfigResource_t * )c_obj ,
304
- k , v );
305
- else if (!strcmp (op_name , "newtopic_set_config" ))
306
- err = rd_kafka_NewTopic_set_config (
307
- (rd_kafka_NewTopic_t * )c_obj , k , v );
308
- else
309
- err = RD_KAFKA_RESP_ERR__NOT_IMPLEMENTED ;
310
-
311
- if (err ) {
312
- PyErr_Format (PyExc_ValueError ,
313
- "%s config %s failed: %s" ,
314
- op_name , k , rd_kafka_err2str (err ));
315
- Py_XDECREF (vs );
316
- Py_XDECREF (vs8 );
317
- Py_DECREF (ks );
318
- Py_XDECREF (ks8 );
319
- return 0 ;
320
- }
272
+ PyObject * vs = NULL , * vs8 = NULL ;
273
+ if (!(vs = cfl_PyObject_Unistr (vo )) ||
274
+ !(v = cfl_PyUnistr_AsUTF8 (vs , & vs8 ))) {
275
+ PyErr_Format (PyExc_ValueError ,
276
+ "expect %s config value for %s "
277
+ "to be unicode string" ,
278
+ op_name , k );
279
+ Py_XDECREF (vs );
280
+ Py_XDECREF (vs8 );
281
+ Py_DECREF (ks );
282
+ Py_XDECREF (ks8 );
283
+ return 0 ;
284
+ }
285
+
286
+ if (!strcmp (op_name , "set_config" ))
287
+ err = rd_kafka_ConfigResource_set_config (
288
+ (rd_kafka_ConfigResource_t * )c_obj ,
289
+ k , v );
290
+ else if (!strcmp (op_name , "newtopic_set_config" ))
291
+ err = rd_kafka_NewTopic_set_config (
292
+ (rd_kafka_NewTopic_t * )c_obj , k , v );
293
+ else
294
+ err = RD_KAFKA_RESP_ERR__NOT_IMPLEMENTED ;
321
295
296
+ if (err ) {
297
+ PyErr_Format (PyExc_ValueError ,
298
+ "%s config %s failed: %s" ,
299
+ op_name , k , rd_kafka_err2str (err ));
322
300
Py_XDECREF (vs );
323
301
Py_XDECREF (vs8 );
302
+ Py_DECREF (ks );
303
+ Py_XDECREF (ks8 );
304
+ return 0 ;
324
305
}
306
+
307
+ Py_XDECREF (vs );
308
+ Py_XDECREF (vs8 );
325
309
Py_DECREF (ks );
326
310
Py_XDECREF (ks8 );
327
311
}
@@ -835,14 +819,13 @@ static PyObject *Admin_describe_configs (Handle *self, PyObject *args,
835
819
static PyObject * Admin_alter_configs (Handle * self , PyObject * args ,
836
820
PyObject * kwargs ) {
837
821
PyObject * resources , * future ;
838
- PyObject * validate_only_obj = NULL , * incremental_obj = NULL ;
822
+ PyObject * validate_only_obj = NULL ;
839
823
static char * kws [] = { "resources" ,
840
824
"future" ,
841
825
/* options */
842
826
"validate_only" ,
843
827
"request_timeout" ,
844
828
"broker" ,
845
- "incremental" ,
846
829
NULL };
847
830
struct Admin_options options = Admin_options_INITIALIZER ;
848
831
rd_kafka_AdminOptions_t * c_options = NULL ;
@@ -853,12 +836,11 @@ static PyObject *Admin_alter_configs (Handle *self, PyObject *args,
853
836
CallState cs ;
854
837
855
838
/* topics is a list of NewPartitions_t objects. */
856
- if (!PyArg_ParseTupleAndKeywords (args , kwargs , "OO|OfiO " , kws ,
839
+ if (!PyArg_ParseTupleAndKeywords (args , kwargs , "OO|Ofi " , kws ,
857
840
& resources , & future ,
858
841
& validate_only_obj ,
859
842
& options .request_timeout ,
860
- & options .broker ,
861
- & incremental_obj ))
843
+ & options .broker ))
862
844
return NULL ;
863
845
864
846
if (!PyList_Check (resources ) ||
@@ -874,12 +856,6 @@ static PyObject *Admin_alter_configs (Handle *self, PyObject *args,
874
856
& options .validate_only ))
875
857
return NULL ;
876
858
877
- if (incremental_obj &&
878
- !cfl_PyBool_get (incremental_obj , "incremental" ,
879
- & options .incremental ))
880
- return NULL ;
881
-
882
-
883
859
c_options = Admin_options_to_c (self , RD_KAFKA_ADMIN_OP_ALTERCONFIGS ,
884
860
& options , future );
885
861
if (!c_options )
@@ -955,30 +931,6 @@ static PyObject *Admin_alter_configs (Handle *self, PyObject *args,
955
931
goto err ;
956
932
}
957
933
Py_DECREF (dict );
958
-
959
- if (!cfl_PyObject_GetAttr (res , "add_config_dict" , & dict ,
960
- & PyDict_Type , 1 )) {
961
- i ++ ;
962
- goto err ;
963
- }
964
- if (!Admin_config_dict_to_c (c_objs [i ], dict , "add_config" )) {
965
- Py_DECREF (dict );
966
- i ++ ;
967
- goto err ;
968
- }
969
- Py_DECREF (dict );
970
-
971
- if (!cfl_PyObject_GetAttr (res , "del_config_dict" , & dict ,
972
- & PyDict_Type , 1 )) {
973
- i ++ ;
974
- goto err ;
975
- }
976
- if (!Admin_config_dict_to_c (c_objs [i ], dict , "del_config" )) {
977
- Py_DECREF (dict );
978
- i ++ ;
979
- goto err ;
980
- }
981
- Py_DECREF (dict );
982
934
}
983
935
984
936
0 commit comments