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

Improve context on pyavd.get_avd_facts exceptions to find the source of the error #4879

Open
1 task done
dlobato opened this issue Jan 14, 2025 · 0 comments
Open
1 task done
Labels
type: enhancement New feature or request

Comments

@dlobato
Copy link
Contributor

dlobato commented Jan 14, 2025

Enhancement summary

Current implementation for pyavd.get_avd_facts thrown exceptions do not contain enough context to find the cause. For instance, the call to _render_avd_switch_facts loops over the inventory hosts but the failed host is not available if an exception is thrown.

The ansible action handles this at https://github.com/aristanetworks/avd/blob/devel/ansible_collections/arista/avd/plugins/action/eos_designs_facts.py#L202 showing the host that failed which helps finding the error.

Which component of AVD is impacted

eos_designs

Use case example

On examples/single-dc-l3ls replace the inventory host dc1-spine2 with dc1-spine3.
Building with ansible avd process fails with error:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: pyavd._errors.AristaAvdInvalidInputsError: 'id' is required to calculate IP addresses.
fatal: [dc1-spine1]: FAILED! => {"changed": false, "msg": "'id' is required to calculate IP addresses for host 'dc1-spine3'."}

Building with pyavd the error doesn't contain the host information which makes hard to find the root cause.
pyavd._errors.AristaAvdMissingVariableError: 'id' is required to calculate IP addresses

Describe the solution you would like

AristaAvdError exceptions contains more context so users have more information to find the root cause.

Describe alternatives you have considered

No response

Additional context

No response

Contributing Guide

  • I agree to follow this project's Code of Conduct
@dlobato dlobato added the type: enhancement New feature or request label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant