-
Notifications
You must be signed in to change notification settings - Fork 201
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(plugins): Move jinja filter code for arista.avd.is_in_filter to PyAVD #4133
Refactor(plugins): Move jinja filter code for arista.avd.is_in_filter to PyAVD #4133
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-4133
# Activate the virtual environment
source test-avd-pr-4133/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/Vibhu-gslab/avd.git@is_in_filter#subdirectory=python-avd" --force
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/Vibhu-gslab/avd.git#/ansible_collections/arista/avd/,is_in_filter --force
# Optional: Install AVD examples
cd test-avd-pr-4133
ansible-playbook arista.avd.install_examples |
8f0c7ba
to
57cdb6d
Compare
57cdb6d
to
5a9b349
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
(HOSTNAME_VALID, None, True), # default filter | ||
(HOSTNAME_VALID, HOSTNAME_FILTER_VALID, True), # valid hostname | ||
(HOSTNAME_INVALID, HOSTNAME_FILTER_VALID, False), # invalid hostname | ||
# TODO: Check if this is a valid testcase. Add a type check? |
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.
This should not be working like this for the last example. Can you please log an issue to revisit the behavior of this filter after migration as changing this now would be a breaking change probably (here we end up looping over every character in the string and checking if any character is in the hostname, which is not the spirit of the filter, or at least should not be given like this as an input)
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.
There is some historic behavior here, where the device-filters in the cvp-related roles accepted a string or a list.
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.
Approving the move. Some of the filter behavior is dubious but that's not the purpose of this PR
Change Summary
Move jinja filter code for arista.avd.is_in_filter to PyAVD
Related Issue(s)
Fixes #4132
Component(s) name
arista.avd.is_in_filter
Proposed changes
Moving the code and unit tests for arista.avd.is_in_filter filter to PyAVD
How to test
CI should catch things.
Checklist
Repository Checklist