-
Notifications
You must be signed in to change notification settings - Fork 230
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
Feat(plugins): Add strict mode and ignore_case flags to natural_sort filter #4298
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-4298
# Activate the virtual environment
source test-avd-pr-4298/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/gmuloc/avd.git@natural-sort-upgrade#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/gmuloc/avd.git#/ansible_collections/arista/avd/,natural-sort-upgrade --force
# Optional: Install AVD examples
cd test-avd-pr-4298
ansible-playbook arista.avd.install_examples |
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.
approved by mistake
The special catch in the template of |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
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
Quality Gate passedIssues Measures |
…filter (aristanetworks#4298) Co-authored-by: Claus Holbech <[email protected]> Co-authored-by: Carl Buchmann <[email protected]>
Change Summary
This PR adds two new flags to the
natural_sort
filterstrict
flag to be able to raise when thesort_key
is missing in one item in the iterable dict or Namespace (default isFalse
for backward compatibility).ignore_case
flag to be able to not ignore the case. Today natural_sort callslower
by default on some strings and this leads to AVD generating config not in the same order as EOS which does not uselower
.Related Issue(s)
Fixes #4242
Component(s) name
plugins
Proposed changes
Adding two flags to the function, with backward compatible default values to avoid impacting the rest of AVD
The goal is then to review the config ordering we have today against EOS and to use the flags where appropriate.
How to test
pytests have been added
Checklist
Note to reviewers
sort
from Jinja -> is it worth it?Repository Checklist