From c8ee186e11bfdf8a3e17c0a6226caaf587fa2e89 Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Thu, 18 Feb 2021 18:16:03 -0500 Subject: Remove warning about role validation with deps (#73653) * Remove warning about role validation with deps * add changelog * update cl --- changelogs/fragments/73653-rolespec-rm-warning.yml | 2 ++ docs/docsite/rst/user_guide/playbooks_reuse_roles.rst | 6 ++++++ lib/ansible/playbook/role/__init__.py | 5 ----- 3 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/73653-rolespec-rm-warning.yml diff --git a/changelogs/fragments/73653-rolespec-rm-warning.yml b/changelogs/fragments/73653-rolespec-rm-warning.yml new file mode 100644 index 0000000000..c3adfc8f7c --- /dev/null +++ b/changelogs/fragments/73653-rolespec-rm-warning.yml @@ -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. diff --git a/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst b/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst index 80ef24e6e0..91a0f66a90 100644 --- a/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst +++ b/docs/docsite/rst/user_guide/playbooks_reuse_roles.rst @@ -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 `, + then validation on those dependencies will run before the dependent role, even if argument validation fails + for the dependent role. + Specification Format -------------------- diff --git a/lib/ansible/playbook/role/__init__.py b/lib/ansible/playbook/role/__init__.py index 448d2a9803..267005ee92 100644 --- a/lib/ansible/playbook/role/__init__.py +++ b/lib/ansible/playbook/role/__init__.py @@ -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') -- cgit v1.2.3