mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
Add GALAXY_COLLECTIONS_PATH_WARNINGS option. (#78487)
* Add GALAXY_COLLECTIONS_PATH_WARNING option. This allows users to disable warnings from `ansible-galaxy collection install` about `--collections-path` missing from Ansible's configured collections_paths.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
minor_changes:
|
||||
- >-
|
||||
Add ``GALAXY_COLLECTIONS_PATH_WARNING`` option to disable the warning
|
||||
given by ``ansible-galaxy collection install`` when installing a collection
|
||||
to a path that isn't in the configured collection paths.
|
||||
@@ -1393,7 +1393,10 @@ class GalaxyCLI(CLI):
|
||||
upgrade = context.CLIARGS.get('upgrade', False)
|
||||
|
||||
collections_path = C.COLLECTIONS_PATHS
|
||||
if len([p for p in collections_path if p.startswith(path)]) == 0:
|
||||
if (
|
||||
C.GALAXY_COLLECTIONS_PATH_WARNING
|
||||
and len([p for p in collections_path if p.startswith(path)]) == 0
|
||||
):
|
||||
display.warning("The specified collections path '%s' is not part of the configured Ansible "
|
||||
"collections paths '%s'. The installed collection will not be picked up in an Ansible "
|
||||
"run, unless within a playbook-adjacent collections directory." % (to_text(path), to_text(":".join(collections_path))))
|
||||
|
||||
@@ -1366,6 +1366,15 @@ GALAXY_COLLECTION_SKELETON_IGNORE:
|
||||
ini:
|
||||
- {key: collection_skeleton_ignore, section: galaxy}
|
||||
type: list
|
||||
GALAXY_COLLECTIONS_PATH_WARNING:
|
||||
name: "ansible-galaxy collection install colections path warnings"
|
||||
description: "whether ``ansible-galaxy collection install`` should warn about ``--collections-path`` missing from configured :ref:`collections_paths`"
|
||||
default: true
|
||||
type: bool
|
||||
env: [{name: ANSIBLE_GALAXY_COLLECTIONS_PATH_WARNING}]
|
||||
ini:
|
||||
- {key: collections_path_warning, section: galaxy}
|
||||
version_added: "2.16"
|
||||
# TODO: unused?
|
||||
#GALAXY_SCMS:
|
||||
# name: Galaxy SCMS
|
||||
|
||||
Reference in New Issue
Block a user