Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecated include #71262

Merged
merged 10 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/deprecate_include.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecated_features:
- include action is deprecated in favor of include_tasks, import_tasks and import_playbook.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
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:
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/playbook/included_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def process_include_results(results, iterator, loader, variable_manager):
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ def _validate_docs(self):
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down