From 73b7ff733a05a42e68921136f042e9be03606413 Mon Sep 17 00:00:00 2001 From: Guillaume Mulocher Date: Wed, 13 Nov 2024 15:29:15 +0100 Subject: [PATCH] Feat(plugins): Verify pyavd extras again in verify_requirements (#4720) --- .../arista/avd/plugins/action/verify_requirements.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ansible_collections/arista/avd/plugins/action/verify_requirements.py b/ansible_collections/arista/avd/plugins/action/verify_requirements.py index eeff92c80e6..df06f0066cf 100644 --- a/ansible_collections/arista/avd/plugins/action/verify_requirements.py +++ b/ansible_collections/arista/avd/plugins/action/verify_requirements.py @@ -4,7 +4,7 @@ import json import sys -from importlib.metadata import Distribution, PackageNotFoundError, version +from importlib.metadata import Distribution, PackageNotFoundError, metadata, version from pathlib import Path from subprocess import PIPE, Popen from typing import Any @@ -112,6 +112,12 @@ def _validate_python_requirements(requirements: list, info: dict) -> bool: msg = f"Wrong format for requirement {raw_req}" raise AnsibleActionFail(msg) from exc + if req.extras: + for subreq_name in metadata(req.name).get_all("Requires-Dist"): + subreq = Requirement(subreq_name) + if subreq.marker: + requirements.extend(subreq_name for marker in subreq.marker._markers if str(marker[0]) == "extra" and str(marker[2]) in req.extras) + if RUNNING_FROM_SOURCE and req.name == "pyavd": display.vvv("AVD is running from source, *not* checking pyavd version.", "Verify Requirements") requirements_dict["valid"][req.name] = {