StephenSorriaux / ansible-kafka-admin

Manage your topic's configuration (partitions, replication factor, parameters), ACLs, quotas, users and get stats, without any effort with this library. It does not use the Kafka scripts and does not require ssh connection to the remote broker.
Apache License 2.0
150 stars 46 forks source link

Unnecessary requirement for acl_operation in module kafka_acls #124

Closed david-freistrom closed 2 years ago

david-freistrom commented 2 years ago

Expected Behavior

Delete all ACLs for a specific Topic

Actual Behavior

acl_operation is a required attributes for kafka_acls module which prevent to delete all ACLs for a specific Topic

Play to Reproduce the Problem

- name: Delete all ACLs for a Topic in Kafka
  StephenSorriaux.ansible_kafka_admin.kafka_acl.kafka_acls:
    bootstrap_servers: "{{ lookup('ENV', 'KAFKA_BOOTSTRAP_SERVERS') }}"
    acls:
      - acl_resource_type: 'topic'
        name: 'test'
        state: 'absent'

Logs from the play with Ansible in debug mode

acl_operation is required

This error is explicitly thrown here but in general not declared as an required attribute. I think its an unnecessary line of code.

https://github.com/StephenSorriaux/ansible-kafka-admin/blob/547ff8c38b7383bdc3f4fafb1d303d28d1c484ae/module_utils/kafka_lib_acl.py#L57

Kafka has not that requirement.

Specifications

StephenSorriaux commented 2 years ago

Hi,

Thank you for the issue.

Maybe removing this check and/or defining the default value for ‘acl_operation’ to ‘all’ might be enough. But I need to perform some tests to check that.