aristanetworks / avd

Arista Validated Designs
https://avd.arista.com
Apache License 2.0
251 stars 186 forks source link

"'trigger_config' is undefined" when generating device documentation #4134

Closed PieterL75 closed 1 week ago

PieterL75 commented 1 week ago

AVD 4.8.0 Python 3.11.7 ansible [core 2.17.0] jinja version = 3.1.4

I have this in my 'FABRIC.yml'

event_handlers:
  - name: clear-host-dampening
    actions:
      bash_command: 'FastCli -p 15 -c "clear bgp evpn host-flap"'
    delay: 300
    trigger: on-logging
    trigger_on_logging:
      regex: EVPN-3-BLACKLISTED_DUPLICATE_MAC

when running the build.yml, I get this error:

TASK [arista.avd.eos_cli_config_gen : Generate device documentation] ********************************************************************************************************************************
fatal: [dc1-spine1 -> localhost]: FAILED! => {"msg": "'trigger_config' is undefined"}
fatal: [dc1-spine2 -> localhost]: FAILED! => {"msg": "'trigger_config' is undefined"}
fatal: [dc1-leaf1b -> localhost]: FAILED! => {"msg": "'trigger_config' is undefined"}
fatal: [dc1-leaf1a -> localhost]: FAILED! => {"msg": "'trigger_config' is undefined"}

Seems that the trigger_config is not defined in some conditions in the event-handlers.j2 https://github.com/aristanetworks/avd/blob/2616f34e4539ca2bdd6e2a8f96a85bdecd2f728e/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/event-handlers.j2#L15 I added

{%             set trigger_config = [] %}

between line 14 and 15, and that worked out

Or there is something else going on, that line 74 is not getting hit properly https://github.com/aristanetworks/avd/blob/2616f34e4539ca2bdd6e2a8f96a85bdecd2f728e/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/event-handlers.j2#L74

gmuloc commented 1 week ago

Hello thanks @PieterL75 for raising this issue!

I confirm that I can repro in AVD 4.8.0 though it is not failing anymore in devel. It has been fixed by https://github.com/aristanetworks/avd/pull/4055 and will be fixed in the next AVD release.

I am closing this issue but feel free to reopen if you have any follow-up question.