Remove warning about role validation with deps (#73653)

* Remove warning about role validation with deps

* add changelog

* update cl
This commit is contained in:
David Shrewsbury 2021-02-18 18:16:03 -05:00 committed by GitHub
parent 1a14996025
commit c8ee186e11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- Remove the warning displayed when validating the arg spec of a role with dependencies and add it to the documentation.

View file

@ -264,6 +264,12 @@ specification defined in the role ``meta/main.yml`` file. When this argument spe
a new task is inserted at the beginning of role execution that will validate the parameters supplied
for the role against the specification. If the parameters fail validation, the role will fail execution.
.. note::
When role argument validation is used on a role that has defined :ref:`dependencies <role_dependencies>`,
then validation on those dependencies will run before the dependent role, even if argument validation fails
for the dependent role.
Specification Format
--------------------

View file

@ -34,10 +34,8 @@ from ansible.playbook.role.metadata import RoleMetadata
from ansible.playbook.taggable import Taggable
from ansible.plugins.loader import add_all_plugin_dirs
from ansible.utils.collection_loader import AnsibleCollectionConfig
from ansible.utils.display import Display
from ansible.utils.vars import combine_vars
display = Display()
__all__ = ['Role', 'hash_params']
@ -288,9 +286,6 @@ class Role(Base, Conditional, Taggable, CollectionSearch):
:returns: The (possibly modified) task list.
'''
if self._metadata.argument_specs:
if self._dependencies:
display.warning("Dependent roles will run before roles with argument specs even if validation fails.")
# Determine the role entry point so we can retrieve the correct argument spec.
# This comes from the `tasks_from` value to include_role or import_role.
entrypoint = self._from_files.get('tasks', 'main')