Improve context on pyavd.get_avd_facts exceptions to find the source of the error #4879
Open
1 task done
Labels
type: enhancement
New feature or request
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
The text was updated successfully, but these errors were encountered: