From 96d6f683c5d7770457d25f80d8a7b8963fc5a114 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Tue, 10 Oct 2023 14:19:54 -0600 Subject: [PATCH] plugin-scan - use explicit collection requirements Install the collections from meta/collection-requirements.yml and tests/collection-requirements.yml to override those found in the `ansible` bundle. We have to use an old ansible to maintain compatability with jinja 2.7 and the collections bundled there are not updated with newer versions of ansible.posix, community.general, etc. At some point when we drop compatability with EL7 and python2, we can drop support for jinja 2.7 and use the latest ansible. Signed-off-by: Rich Megginson --- src/tox_lsr/config_files/tox-default.ini | 9 +++++++++ tests/fixtures/test_tox_merge_ini/result.ini | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/src/tox_lsr/config_files/tox-default.ini b/src/tox_lsr/config_files/tox-default.ini index 6df2c2e..80bd726 100644 --- a/src/tox_lsr/config_files/tox-default.ini +++ b/src/tox_lsr/config_files/tox-default.ini @@ -380,8 +380,17 @@ allowlist_externals = deps = ansible==6.* jinja2==2.7.* ; python_version <= "3.7" +setenv = + ANSIBLE_COLLECTIONS_PATHS = {envdir} commands = curl -L -o {envdir}/report-modules-plugins.py https://raw.githubusercontent.com/linux-system-roles/auto-maintenance/master/report-modules-plugins.py + bash -c '\ + set -euxo pipefail; \ + for file in meta/collection-requirements.yml tests/collection-requirements.yml; do \ + if [ -f "$file" ]; then \ + ansible-galaxy collection install -vv --force -r "$file"; \ + fi; \ + done' python {env:LSR_REPORT_MODULES_PLUGINS:{envdir}/report-modules-plugins.py} \ {env:RUN_PLUGIN_SCAN_EXTRA_ARGS:} --details {posargs} . diff --git a/tests/fixtures/test_tox_merge_ini/result.ini b/tests/fixtures/test_tox_merge_ini/result.ini index 8711ca7..77ba19f 100644 --- a/tests/fixtures/test_tox_merge_ini/result.ini +++ b/tests/fixtures/test_tox_merge_ini/result.ini @@ -306,7 +306,15 @@ allowlist_externals = curl bash deps = ansible==6.* jinja2==2.7.* ; python_version <= "3.7" +setenv = ANSIBLE_COLLECTIONS_PATHS = {envdir} commands = curl -L -o {envdir}/report-modules-plugins.py https://raw.githubusercontent.com/linux-system-roles/auto-maintenance/master/report-modules-plugins.py + bash -c '\ + set -euxo pipefail; \ + for file in meta/collection-requirements.yml tests/collection-requirements.yml; do \ + if [ -f "$file" ]; then \ + ansible-galaxy collection install -vv --force -r "$file"; \ + fi; \ + done' python {env:LSR_REPORT_MODULES_PLUGINS:{envdir}/report-modules-plugins.py} \ {env:RUN_PLUGIN_SCAN_EXTRA_ARGS:} --details {posargs} .