From 62d087930acb128f13f8c096f1cf944ba6ffd7e0 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Thu, 11 May 2023 22:53:01 +0000 Subject: [PATCH] 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 --- ansible-packaging.spec | 5 ++++- ansible_collection.py | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ansible-packaging.spec b/ansible-packaging.spec index 03d5a78..1a5ec61 100644 --- a/ansible-packaging.spec +++ b/ansible-packaging.spec @@ -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 - 1-10 +- %%ansible_collection_install - disable spurious collections path warnings + * Wed Jan 18 2023 Fedora Release Engineering - 1-9.1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild diff --git a/ansible_collection.py b/ansible_collection.py index 70093be..80c4b33 100755 --- a/ansible_collection.py +++ b/ansible_collection.py @@ -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: