The information that follows represents knowledge that I wish I had when first contributing to the project. Keep in mind that this guide may not be applicable to your environment, and it should not be considered a comprehensive tutorial for the dev-env installation, nor a walkthrough. While many of these issues and fixes might seem obvious, when beginning contributions to a new project there is a lot of new information to absorb and systems to figure out, I figure the easier some steps are the better.
If your Python environment resembles mine, it likely contains a myriad of randomly installed packages, with multiple Python versions and environments set up. In this context, I found pipenv to be the most straightforward tool. A simple pipenv install --python 3.11
command sets up the required Python environment in the AVD folder, followed by pipenv shell
. After this, I configured VSCode to use the Python environment that pipenv established as my default interpreter, making sure all terminal sessions were in this env.
Setting the relevant Ansible collections path allows you to use ansible_collections without the necessity to rebuild the collection. Here's the command I used: ANSIBLE_COLLECTIONS_PATHS="/Users/hampton/Documents/repos/avd/arista-ansible/ansible-avd/ansible_collections:/Users/hampton/.ansible/collections/ansible_collections/"
. One can always just configure the ansible.cfg file to change the collections path system/user wide if they desire
Title explains https://avd.sh/en/stable/docs/contribution/development.html#pre-commit-hook
The large schema yaml and json files for both eos_designs and eos_cli_config_gen are built using the various schema files in their respective schema_fragements/ directory. Changes to the combined schema files will be discarded if they are sourced from the smaller fragment files. Rebuilding of the schema based on the fragments is done with ansible-playbook playbooks/_build_schemas_and_docs.yml
, but will also be performed by the pre-commit job.
While running ansible-playbook playbooks/_build_schemas_and_docs.yml
, I encountered a problem: the eos_designs.schema.yml
and relevant docs were not updating, and no error messages were provided. The root cause of this problem is that it modifies the schema where the collection is installed. Thus, ensure that you're using the ANSIBLE_COLLECTIONS_PATHS
environment variable, or that you've updated the ansible.cfg file so that it uses your local collection.
The AVD repo is quite large with many moving pieces. I found that looking at small feature commits leads to the ability to quickly find the relevent files and reason through how those changes work. For example
- Feat(eos_designs): Add schema for queue_monitor_length
- Feat(eos_cli_config_gen): BGP RR preserve-attributes
When making a molecule test that needs a need host I like to start out by making that test without the feature I am implementing. I will then commit that base config to git, this will make it so that any of the config changes one is making are easy to differentiate since it'll be the only text added to that new file as opposed to the whole file being new like before.