deprecated include (#71262)

* deprecated include

  Update lib/ansible/modules/_include.py
  updated version numbers in schema check (real fix in separate PR)

Co-authored-by: flowerysong <junk+github@flowerysong.com>
Co-authored-by: Matt Clay <matt@mystile.com>
This commit is contained in:
Brian Coca 2021-04-15 14:19:04 -04:00 committed by GitHub
parent 3cbe16fa7a
commit 0a7670d1f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 3 deletions

View file

@ -0,0 +1,2 @@
deprecated_features:
- include action is deprecated in favor of include_tasks, import_tasks and import_playbook.

View file

@ -25,6 +25,12 @@ description:
directive (which was added in Ansible 2.1) to bypass autodetection.
- This module is also supported for Windows targets.
version_added: "0.6"
deprecated:
why: it has too many conflicting behaviours depending on keyword combinations and it was unclear how it should behave in each case.
new actions were developed that were specific about each case and related behaviours.
alternative: include_tasks, import_tasks, import_playbook
removed_in: "2.16"
removed_from_collection: 'ansible.builtin'
options:
free-form:
description:

View file

@ -70,6 +70,9 @@ class IncludedFile:
original_task = res._task
if original_task.action in C._ACTION_ALL_INCLUDES:
if original_task.action in C._ACTION_INCLUDE:
display.deprecated('"include" is deprecated, use include_tasks/import_tasks/import_playbook instead', "2.16")
if original_task.loop:
if 'results' not in res._result:
continue

View file

@ -1122,7 +1122,7 @@ class ModuleValidator(Validator):
if not (filename_deprecated_or_removed or removed or deprecated or doc_deprecated):
mismatched_deprecation = False
else:
if (filename_deprecated_or_removed and deprecated and doc_deprecated):
if (filename_deprecated_or_removed and doc_deprecated):
mismatched_deprecation = False
if (filename_deprecated_or_removed and removed and not (documentation_exists or examples_exist or returns_exist)):
mismatched_deprecation = False

View file

@ -450,8 +450,7 @@ def deprecation_schema(for_collection):
# Deprecation cycle changed at 2.4 (though not retroactively)
# 2.3 -> removed_in: "2.5" + n for docs stub
# 2.4 -> removed_in: "2.8" + n for docs stub
Required('removed_in'): Any(
"2.2", "2.3", "2.4", "2.5", "2.6", "2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14"),
Required('removed_in'): Any("2.12", "2.13", "2.14", "2.15", "2.16"),
}
version_schema.update(main_fields)