confluentinc / cp-ansible

Ansible playbooks for the Confluent Platform
Apache License 2.0
30 stars 406 forks source link

Collection confluent.platform 7.6.1 filters.py file differs from the GitHub version #1719

Open rouba002 opened 2 months ago

rouba002 commented 2 months ago

File filters.py used for definition of custom filters is different in collection .tar file from the version available via git. This causes issues when running playbook. Namely construction of kafka_broker_final_properties or any task where confluent.platform.listener_properties() filter is called stops with error, due to different number of input variables.

The error when running specific tasks with this filter being used (only part of the output):

TASK [kafka_broker : Assert log.dirs Property not Misconfigured] **************************************************************************************************************************************************************************************************************
Thursday 04 July 2024  14:54:16 +0200 (0:00:00.092)       0:00:26.895 *********
fatal: [kf01.edc.ttc-noviq.cz]: FAILED! => {"msg": "The conditional check 'kafka_broker_final_properties['log.dirs'].split(',')[0] != \"/\"' failed. The error was: An unhandled exception occurred while templating '{{ kafka_broker_combined_properties | combine(kafka_broker_custom_properties) }}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while templating 
...
...
... FilterModule.listener_properties() takes 20 positional arguments but 27 were given. FilterModule.listener_properties() takes 20 positional arguments but 27 were given"}

To Reproduce

Expected behaviour No errors should occur.

Logs See above

Environment (please complete the following information):

FIX: Just replace the filters.py from plugins/filter/filters.py in the collection firectory. In my case cp plugins/filter/filters.py /home/ansible-user/.ansible/collections/ansible_collections/confluent/platform/plugins/filter/filters.py

Additional context I have not performed the whole instalation, just took over after my colleague, when things went in the wrong direction. So maybe there where some extra steps in the install procedure done. From what I tell, this specific file is definitely differrent and copying the GIT version into collection dir fixes the situation.

Thank you for the investigation r.

mansisinha commented 1 month ago

why do you need to install from ansible galaxy and then git clone as well? Adding to this, please check that you're cloning the correct branch, it might be that you are cloning master branch, which has more arguments for this python function compared to 7.6.1

flisak-robert commented 1 month ago

we're experiencing a similar issue with version 7.6.2. Playbook is failing with listener_properties() takes 20 positional arguments but 22 were given

mansisinha commented 1 month ago

hey @flisak-robert , could you please add the steps and commands that you followed to run into this behaviour? Also, could you please share the git branch that you are using?

flisak-robert commented 1 month ago

hey @flisak-robert , could you please add the steps that you followed to run into this behaviour? Also, could you please share the git branch that you are using?

I have a fork of this repository and currently I'm version at 7.3.4, I created a new branch based on this repo's tag v7.6.2 and ran ansible.

Filters.py file matches exactly with the one in this git tag v7.6.2.

mansisinha commented 1 month ago

we have added 2 new arguments in listener_properties 7.6.2. You might be running into that. You might run into issues if you're using custom playbooks on top of cp-ansible playbooks which are overwriting listener_properties somewhere