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>
pull/74296/head
Brian Coca 3 years ago committed by GitHub
parent 3cbe16fa7a
commit 0a7670d1f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -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:

@ -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

@ -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

@ -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)

Loading…
Cancel
Save