collection_install: disable GALAXY_COLLECTIONS_PATH_WARNING

This silences spurious warnings when installing collections into a directory
outside ansible's configured collections path.

Relates: https://github.com/ansible/ansible/pull/78487
i9ce
Maxwell G 2 years ago
parent e967649fbc
commit 62d087930a
No known key found for this signature in database
GPG Key ID: F79E4E25E8C661F8

@ -1,6 +1,6 @@
Name: ansible-packaging
Version: 1
Release: 9.1%{?dist}
Release: 10%{?dist}
Summary: RPM packaging macros and generators for Ansible collections
License: GPL-3.0-or-later
@ -149,6 +149,9 @@ echo "Ensure macro prefers the collection namespace and name passed as an argume
%changelog
* Thu May 11 2023 Maxwell G <maxwell@gtmx.me> - 1-10
- %%ansible_collection_install - disable spurious collections path warnings
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1-9.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

@ -19,6 +19,7 @@ the provided arguments.
"""
import argparse
import os
import shutil
import subprocess
import sys
@ -96,7 +97,12 @@ class AnsibleCollection:
# Without this, the print statements are shown after the command
# output when building in mock.
sys.stdout.flush()
subprocess.run(args, cwd=temppath, check=True)
subprocess.run(
args,
cwd=temppath,
check=True,
env={**os.environ, "ANSIBLE_GALAXY_COLLECTIONS_PATH_WARNING": "0"},
)
def parseargs() -> argparse.Namespace:

Loading…
Cancel
Save