-
Notifications
You must be signed in to change notification settings - Fork 212
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
Refactor(pyavd): Adding path
attribute to the validation error for removed keys
#4688
Refactor(pyavd): Adding path
attribute to the validation error for removed keys
#4688
Conversation
Review docs on Read the Docs To test this pull request: # Create virtual environment for this testing below the current directory
python -m venv test-avd-pr-4688
# Activate the virtual environment
source test-avd-pr-4688/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/Shivani-gslab/avd.git@fix_pyavd_validation_error#subdirectory=python-avd" --force
# Point Ansible collections path to the Python virtual environment
export ANSIBLE_COLLECTIONS_PATH=$VIRTUAL_ENV/ansible_collections
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/Shivani-gslab/avd.git#/ansible_collections/arista/avd/,fix_pyavd_validation_error --force
# Optional: Install AVD examples
cd test-avd-pr-4688
ansible-playbook arista.avd.install_examples |
9d85113
to
963efb1
Compare
0276c19
to
6cf77ed
Compare
to_validation_error
method to AvdDeprecationWarningpath
attribute to the validation error for removed keys
6cf77ed
to
00bf720
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Only a minor suggestion to avoid later surprises.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Co-authored-by: Claus Holbech <[email protected]>
dbb3956
to
5193a12
Compare
Quality Gate passedIssues Measures |
Change Summary
In https://github.com/aristanetworks/avd/blob/devel/python-avd/pyavd/avd_schema_tools.py#L67,
the AvdDeprecationWarning is converted to AvdValidationError for the removed keys.
It does not have path attribute which is needed for highlighting errors in AVD VSCode extension.
Updating the conversion to get the path attribute.
Related Issue(s)
Fixes #https://github.com/aristanetworks/vscode-avd/issues/5
Component(s) name
pyavd
Proposed changes
Adding
to_validation_error
method to AvdDeprecationWarning for error conversion along with getting the path attribute.Using this method in schema tools for getting validation error.
How to test
Checklist
User Checklist
Repository Checklist