Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eos_cli_config_gen: errdisable documentation J2 expects recovery.interval to be always set #4971

Closed
1 task done
alexeygorbunov opened this issue Feb 4, 2025 · 0 comments · Fixed by #4979
Closed
1 task done
Assignees
Labels
type: bug Something isn't working

Comments

@alexeygorbunov
Copy link
Contributor

Issue Summary

Documentation template python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/errdisable.j2 unconditionally accesses errdisable.recovery.interval without trying to confirm it's existence or to set a default value (defined in schema but not implemented in J2):

{%         if errdisable.recovery.interval is arista.avd.defined %}
{%         endif %}
{%         if errdisable.recovery.causes is defined %}
|  Detect Cause | Enabled | Interval |
| ------------- | ------- | -------- |
{%             for cause in errdisable.recovery.causes | arista.avd.natural_sort %}
{%                 if cause == 'arp-inspection' %}
| {{ cause }} | True | {{ errdisable.recovery.interval }} |
{%                 elif cause == 'bpduguard' %}
...

Which component(s) of AVD impacted

eos_cli_config_gen

How do you run AVD ?

PyAVD

Steps to reproduce

Use input data model with `errdisable.recovery.causes` but without `errdisable.recovery.interval`


errdisable:
  recovery:
    causes:
      - speed-misconfigured

Relevant log output

File "/usr/local/lib/python3.12/site-packages/pyavd/_eos_cli_config_gen/j2templates/compiled_templates/tmpl_c671a478831eaa86b3ae485f99407794782d2c7e.py", line 117, in top-level template code
    for event in gen:
  File "/usr/local/lib/python3.12/site-packages/pyavd/_eos_cli_config_gen/j2templates/compiled_templates/tmpl_a1a80e0d32b19177c16af5276463801f42022e9e.py", line 63, in top-level template code
    yield '| '
jinja2.exceptions.UndefinedError: 'ansible.parsing.yaml.objects.AnsibleMapping object' has no attribute 'interval'
fatal: [bluespine -> localhost]: FAILED! => {
    "changed": false,
    "msg": "Error during plugin execution: 'ansible.parsing.yaml.objects.AnsibleMapping object' has no attribute 'interval'"

Contributing Guide

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
2 participants