From 070a5557d19f20f1e20fc0c8f002498686bfee9c Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Wed, 23 May 2018 07:10:36 +1000 Subject: [PATCH] always_run: removed deprecated always_run task option (#40470) --- changelogs/fragments/always_run_removal.yaml | 2 ++ docs/docsite/keyword_desc.yml | 1 - docs/docsite/rst/porting_guides/porting_guide_2.6.rst | 2 +- lib/ansible/playbook/base.py | 1 - lib/ansible/playbook/play_context.py | 5 ----- .../targets/check_mode/roles/test_always_run/meta/main.yml | 2 +- .../targets/check_mode/roles/test_always_run/tasks/main.yml | 2 +- test/legacy/roles/prepare_tests/tasks/main.yml | 3 +-- test/units/playbook/test_base.py | 2 -- 9 files changed, 6 insertions(+), 14 deletions(-) create mode 100644 changelogs/fragments/always_run_removal.yaml diff --git a/changelogs/fragments/always_run_removal.yaml b/changelogs/fragments/always_run_removal.yaml new file mode 100644 index 00000000000..6805b894e20 --- /dev/null +++ b/changelogs/fragments/always_run_removal.yaml @@ -0,0 +1,2 @@ +removed_features: +- removed the deprecated always_run task option, please use `check_mode: no` instead diff --git a/docs/docsite/keyword_desc.yml b/docs/docsite/keyword_desc.yml index 189ca389f3b..ba6231553ab 100644 --- a/docs/docsite/keyword_desc.yml +++ b/docs/docsite/keyword_desc.yml @@ -4,7 +4,6 @@ accelerate_port: "*DEPRECATED*, set to override default port use for accelerate action: "The 'action' to execute for a task, it normally translates into a C(module) or action plugin." args: "*DEPRECATED*, A secondary way to add arguments into a task. Takes a dictionary in which keys map to options and values." always: List of tasks, in a block, that execute no matter if there is an error in the block or not. -always_run: "*DEPRECATED*, forces a task to run even in check mode. Use :term:`check_mode` directive instead." any_errors_fatal: Force any un-handled task errors on any host to propagate to all hosts and end the play. async: Run a task asynchronously if the C(action) supports this; value is maximum runtime in seconds. become: Boolean that controls if privilege escalation is used or not on :term:`Task` execution. diff --git a/docs/docsite/rst/porting_guides/porting_guide_2.6.rst b/docs/docsite/rst/porting_guides/porting_guide_2.6.rst index 456717ee83a..717f8b72f54 100644 --- a/docs/docsite/rst/porting_guides/porting_guide_2.6.rst +++ b/docs/docsite/rst/porting_guides/porting_guide_2.6.rst @@ -17,7 +17,7 @@ This document is part of a collection on porting. The complete list of porting g Playbook ======== -No notable changes. +* The deprecated task option ``always_run`` has been removed, please use ``check_mode: no`` instead. Deprecated ========== diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py index 16669d83b4e..10f8fe90a49 100644 --- a/lib/ansible/playbook/base.py +++ b/lib/ansible/playbook/base.py @@ -578,7 +578,6 @@ class Base(FieldAttributeBase): # flags and misc. settings _environment = FieldAttribute(isa='list', extend=True, prepend=True) _no_log = FieldAttribute(isa='bool') - _always_run = FieldAttribute(isa='bool') _run_once = FieldAttribute(isa='bool') _ignore_errors = FieldAttribute(isa='bool') _check_mode = FieldAttribute(isa='bool') diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index f291e35f201..0256045b3ce 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -436,11 +436,6 @@ class PlayContext(Base): if new_info.no_log is None: new_info.no_log = C.DEFAULT_NO_LOG - if task.always_run: - display.deprecated("always_run is deprecated. Use check_mode = no instead.", version="2.4", removed=False) - new_info.check_mode = False - - # check_mode replaces always_run, overwrite always_run if both are given if task.check_mode is not None: new_info.check_mode = task.check_mode diff --git a/test/integration/targets/check_mode/roles/test_always_run/meta/main.yml b/test/integration/targets/check_mode/roles/test_always_run/meta/main.yml index 58a728044b2..d06fd48cc17 100644 --- a/test/integration/targets/check_mode/roles/test_always_run/meta/main.yml +++ b/test/integration/targets/check_mode/roles/test_always_run/meta/main.yml @@ -1,4 +1,4 @@ -# test code for the always_run option +# test code for the check_mode: no option # (c) 2014, James Cammarata # This file is part of Ansible diff --git a/test/integration/targets/check_mode/roles/test_always_run/tasks/main.yml b/test/integration/targets/check_mode/roles/test_always_run/tasks/main.yml index eb27785ad6d..59bfb1d6377 100644 --- a/test/integration/targets/check_mode/roles/test_always_run/tasks/main.yml +++ b/test/integration/targets/check_mode/roles/test_always_run/tasks/main.yml @@ -1,4 +1,4 @@ -# test code for the always_run option +# test code for the check_mode: no option # (c) 2014, James Cammarata # This file is part of Ansible diff --git a/test/legacy/roles/prepare_tests/tasks/main.yml b/test/legacy/roles/prepare_tests/tasks/main.yml index a0af45cdf10..93cb8ded6fe 100644 --- a/test/legacy/roles/prepare_tests/tasks/main.yml +++ b/test/legacy/roles/prepare_tests/tasks/main.yml @@ -19,13 +19,12 @@ #- name: clean out the test directory # file: name={{output_dir|mandatory}} state=absent -# always_run: True # tags: # - prepare # when: clean_working_dir|default("yes")|bool # #- name: create the test directory # file: name={{output_dir}} state=directory -# always_run: True +# check_mode: no # tags: # - prepare diff --git a/test/units/playbook/test_base.py b/test/units/playbook/test_base.py index c7b21961721..b4723cd83a5 100644 --- a/test/units/playbook/test_base.py +++ b/test/units/playbook/test_base.py @@ -114,8 +114,6 @@ class TestBase(unittest.TestCase): data = {'no_log': False, 'remote_user': None, 'vars': self.assorted_vars, - # 'check_mode': False, - 'always_run': False, 'environment': [], 'run_once': False, 'connection': None,