Bug #2111827 “Deployment fails due to trailing comma in kolla-to…” : Bugs : kolla-ansible

Description:
**Bug Report**

What happened:
Deployment fails with a JSON parsing error due to an unguarded trailing comma in the config_files list in kolla-toolbox.json.j2. This occurs when:

    enable_rabbitmq is set to false

    kolla_copy_ca_into_containers is set to true

Current Impact:
  Cannot use an external rabbitmq cluster when tls is enabled

cat kolla-ansible/ansible/roles/common/templates/kolla-toolbox.json.j2
{
    “command”: “kolla_toolbox”,
    “config_files”: [
        {% if enable_rabbitmq | bool %}{
            “source”: “{{ container_config_directory }}/rabbitmq-erlang.cookie”,
            “dest”: “/var/lib/rabbitmq/.erlang.cookie”,
            “owner”: “rabbitmq”,
            “perm”: “0600”
        },
        {
            “source”: “{{ container_config_directory }}/rabbitmq-env.conf”,
            “dest”: “/etc/rabbitmq/rabbitmq-env.conf”,
            “owner”: “rabbitmq”,
            “perm”: “0600”
        },
        {
            “source”: “{{ container_config_directory }}/erl_inetrc”,
            “dest”: “/etc/rabbitmq/erl_inetrc”,
            “owner”: “rabbitmq”,
            “perm”: “0600”
        }{% endif %}{% if kolla_copy_ca_into_containers | bool %}, ####—> This comma remains alone when enable_rabbitmq is set to false and kolla_copy_ca_into_containers is set to true
        {
            “source”: “{{ container_config_directory }}/ca-certificates”,
            “dest”: “/var/lib/kolla/share/ca-certificates“,
            “owner”: “root”,
            “perm”: “0600”
        }{% endif %}
    ],
    “permissions”: [
        {
            “path”: “/var/log/kolla/ansible.log”,
            “perm”: “0664”,
            “owner”: “ansible:kolla”
        }
    ]
}

Steps to Reproduce:

    Set enable_rabbitmq: false.

    Set kolla_copy_ca_into_containers: true.

    Run kolla-ansible deploy.

    Observe the deployment failure and check the rendered kolla-toolbox.json.

**Environment**
kolla-ansible version: stable/2025.1

Read more here: Source link