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

Refactor(plugins): Move jinja filter code for arista.avd.default to PyAVD #4047

Conversation

ClausHolbechArista
Copy link
Contributor

Change Summary

Move jinja filter code for arista.avd.default to PyAVD

Component(s) name

Filter

  • arista.avd.default

Proposed changes

  • Add PyAVD as requirement for Ansible AVD.
    • Always same version as Ansible collection.
    • Editable install when developing and in CI.
  • Write decorator/wrapper for jinja filters, to raise proper AnsibleFilterErrors as needed.
  • Move arista.avd.default code to PyAVD and optimize the implementation.
  • Change ansible filter to import pyavd including handling of missing pyavd using the wrapper.

How to test

CI should catch things.

Checklist

User Checklist

  • N/A

Repository Checklist

  • My code has been rebased from devel before I start
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and documentation have been updated accordingly.
  • I have updated molecule CI testing accordingly. (check the box if not applicable)

@ClausHolbechArista ClausHolbechArista requested review from a team as code owners May 28, 2024 19:21
Copy link

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-4047
# Activate the virtual environment
source test-avd-pr-4047/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/ClausHolbechArista/avd.git@refactor/move-jinja-filter-code-to-pyavd/default#subdirectory=python-avd" --force
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/ClausHolbechArista/avd.git#/ansible_collections/arista/avd/,refactor/move-jinja-filter-code-to-pyavd/default --force
# Optional: Install AVD examples
cd test-avd-pr-4047
ansible-playbook arista.avd.install_examples

@Vibhu-gslab Vibhu-gslab force-pushed the refactor/move-jinja-filter-code-to-pyavd/default branch from 5abd758 to 1918963 Compare May 30, 2024 10:54
@ClausHolbechArista ClausHolbechArista force-pushed the refactor/move-jinja-filter-code-to-pyavd/default branch from cba5fc2 to e799d16 Compare May 31, 2024 13:02
@ClausHolbechArista ClausHolbechArista marked this pull request as ready for review May 31, 2024 13:19
Copy link

sonarcloud bot commented May 31, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@carlbuchmann carlbuchmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ClausHolbechArista ClausHolbechArista merged commit 1f76af7 into aristanetworks:devel May 31, 2024
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants