From 0015d4cef3e263bd9a1d7ef45bc277976b890c1a Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 10 Sep 2018 15:05:52 -0500 Subject: [PATCH] 2.8 Core Deprecation Removal (#45232) * Remove deprecated ansible.vars.unsafe_proxy. Fixes #45040 * Remove deprecated validate_md5 alias from fetch module. Fixes #45039 * Remove deprecated private arg from import/include_role. Fixes #45038 * All include deprecations bumped to 2.12. Fixes #45037 * Add changelog for deprecated removals --- .../fragments/2.8-core-deprecations.yaml | 4 +++ lib/ansible/modules/files/fetch.py | 1 - .../modules/utilities/logic/import_role.py | 6 ---- .../modules/utilities/logic/include_role.py | 4 --- lib/ansible/playbook/__init__.py | 2 +- lib/ansible/playbook/role_include.py | 11 ++----- lib/ansible/plugins/action/fetch.py | 11 +------ lib/ansible/vars/unsafe_proxy.py | 31 ------------------- .../include_import/role/test_import_role.yml | 4 --- .../include_import/role/test_include_role.yml | 3 -- 10 files changed, 8 insertions(+), 69 deletions(-) create mode 100644 changelogs/fragments/2.8-core-deprecations.yaml delete mode 100644 lib/ansible/vars/unsafe_proxy.py diff --git a/changelogs/fragments/2.8-core-deprecations.yaml b/changelogs/fragments/2.8-core-deprecations.yaml new file mode 100644 index 00000000000..b632350c62c --- /dev/null +++ b/changelogs/fragments/2.8-core-deprecations.yaml @@ -0,0 +1,4 @@ +minor_changes: +- ansible.vars.unsafe_proxy - Removed deprecated file (https://github.com/ansible/ansible/issues/45040) +- fetch - Removed deprecated validate_md5 alias (https://github.com/ansible/ansible/issues/45039) +- include_role/import_role - Removed deprecated private argument (https://github.com/ansible/ansible/issues/45038) diff --git a/lib/ansible/modules/files/fetch.py b/lib/ansible/modules/files/fetch.py index 364f9f45aff..07401180e01 100644 --- a/lib/ansible/modules/files/fetch.py +++ b/lib/ansible/modules/files/fetch.py @@ -49,7 +49,6 @@ options: - Verify that the source and destination checksums match after the files are fetched. type: bool default: 'yes' - aliases: [ "validate_md5" ] flat: version_added: "1.2" description: diff --git a/lib/ansible/modules/utilities/logic/import_role.py b/lib/ansible/modules/utilities/logic/import_role.py index 2b2d2b9a3ec..148e7ad1543 100644 --- a/lib/ansible/modules/utilities/logic/import_role.py +++ b/lib/ansible/modules/utilities/logic/import_role.py @@ -48,12 +48,6 @@ options: - Overrides the role's metadata setting to allow using a role more than once with the same parameters. type: bool default: 'yes' - private: - description: - - This option is a no op, and the functionality described in previous versions was not implemented. This - option will be removed in Ansible v2.8. - type: bool - default: 'no' notes: - Handlers are made available to the whole play. - "Since Ansible 2.7: variables defined in C(vars) and C(defaults) for the role are exposed at playbook parsing time. diff --git a/lib/ansible/modules/utilities/logic/include_role.py b/lib/ansible/modules/utilities/logic/include_role.py index 155ce10f00c..56e0ccf1bcf 100644 --- a/lib/ansible/modules/utilities/logic/include_role.py +++ b/lib/ansible/modules/utilities/logic/include_role.py @@ -51,10 +51,6 @@ options: - Overrides the role's metadata setting to allow using a role more than once with the same parameters. type: bool default: 'yes' - private: - description: - - This option is a no op, and the functionality described in previous versions was not implemented. This - option will be removed in Ansible v2.8. public: description: - This option dictates whether the role's C(vars) and C(defaults) are exposed to the playbook. If set to C(yes) diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index 0ec3e10e223..f365566f905 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -95,7 +95,7 @@ class Playbook: if any(action in entry for action in ('import_playbook', 'include')): if 'include' in entry: - display.deprecated("'include' for playbook includes. You should use 'import_playbook' instead", version="2.8") + display.deprecated("'include' for playbook includes. You should use 'import_playbook' instead", version="2.12") pb = PlaybookInclude.load(entry, basedir=self._basedir, variable_manager=variable_manager, loader=self._loader) if pb is not None: self._entries.extend(pb._entries) diff --git a/lib/ansible/playbook/role_include.py b/lib/ansible/playbook/role_include.py index 057964752fd..bfabca4b554 100644 --- a/lib/ansible/playbook/role_include.py +++ b/lib/ansible/playbook/role_include.py @@ -46,7 +46,7 @@ class IncludeRole(TaskInclude): BASE = ('name', 'role') # directly assigned FROM_ARGS = ('tasks_from', 'vars_from', 'defaults_from') # used to populate from dict in role - OTHER_ARGS = ('apply', 'private', 'public', 'allow_duplicates') # assigned to matching property + OTHER_ARGS = ('apply', 'public', 'allow_duplicates') # assigned to matching property VALID_ARGS = tuple(frozenset(BASE + FROM_ARGS + OTHER_ARGS)) # all valid args # ================================================================================= @@ -54,7 +54,6 @@ class IncludeRole(TaskInclude): # private as this is a 'module options' vs a task property _allow_duplicates = FieldAttribute(isa='bool', default=True, private=True) - _private = FieldAttribute(isa='bool', default=None, private=True) _public = FieldAttribute(isa='bool', default=False, private=True) def __init__(self, block=None, role=None, task_include=None): @@ -127,13 +126,7 @@ class IncludeRole(TaskInclude): raise AnsibleParserError("'name' is a required field for %s." % ir.action, obj=data) if 'public' in ir.args and ir.action != 'include_role': - raise AnsibleParserError('Invalid options for %s: private' % ir.action, obj=data) - - if 'private' in ir.args: - display.deprecated( - msg='Supplying "private" for "%s" is a no op, and is deprecated' % ir.action, - version='2.8' - ) + raise AnsibleParserError('Invalid options for %s: public' % ir.action, obj=data) # validate bad args, otherwise we silently ignore bad_opts = my_arg_names.difference(IncludeRole.VALID_ARGS) diff --git a/lib/ansible/plugins/action/fetch.py b/lib/ansible/plugins/action/fetch.py index 475c9df9f6f..8d2c59f31ef 100644 --- a/lib/ansible/plugins/action/fetch.py +++ b/lib/ansible/plugins/action/fetch.py @@ -55,9 +55,7 @@ class ActionModule(ActionBase): dest = self._task.args.get('dest', None) flat = boolean(self._task.args.get('flat'), strict=False) fail_on_missing = boolean(self._task.args.get('fail_on_missing', True), strict=False) - validate_checksum = boolean(self._task.args.get('validate_checksum', - self._task.args.get('validate_md5', True)), - strict=False) + validate_checksum = boolean(self._task.args.get('validate_checksum', True), strict=False) # validate source and dest are strings FIXME: use basic.py and module specs if not isinstance(source, string_types): @@ -66,13 +64,6 @@ class ActionModule(ActionBase): if not isinstance(dest, string_types): result['msg'] = "Invalid type supplied for dest option, it must be a string" - # validate_md5 is the deprecated way to specify validate_checksum - if 'validate_md5' in self._task.args and 'validate_checksum' in self._task.args: - result['msg'] = "validate_checksum and validate_md5 cannot both be specified" - - if 'validate_md5' in self._task.args: - display.deprecated('Use validate_checksum instead of validate_md5', version='2.8') - if source is None or dest is None: result['msg'] = "src and dest are required" diff --git a/lib/ansible/vars/unsafe_proxy.py b/lib/ansible/vars/unsafe_proxy.py deleted file mode 100644 index 05e50562773..00000000000 --- a/lib/ansible/vars/unsafe_proxy.py +++ /dev/null @@ -1,31 +0,0 @@ -# (c) 2017, Toshio Kuratomi -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -# This is backwards compat. unsafe_proxy was moved to avoid circular imports. -from ansible.utils.unsafe_proxy import * # pylint: disable=wildcard-import,unused-wildcard-import - -try: - from __main__ import display -except: - from ansible.utils.display import Display - display = Display() - -display.deprecated('ansible.vars.unsafe_proxy is deprecated. Use ansible.utils.unsafe_proxy instead.', version='2.8') diff --git a/test/integration/targets/include_import/role/test_import_role.yml b/test/integration/targets/include_import/role/test_import_role.yml index 492e32a5676..d45ff79bd40 100644 --- a/test/integration/targets/include_import/role/test_import_role.yml +++ b/test/integration/targets/include_import/role/test_import_role.yml @@ -66,11 +66,7 @@ name: role3 tasks_from: vartest.yml vars_from: role3vars.yml - private: no - # FIXME Setting private: no in previous task does not make the variables - # available to the play - # - name: Assert that variables defined in previous task are available to play assert: that: diff --git a/test/integration/targets/include_import/role/test_include_role.yml b/test/integration/targets/include_import/role/test_include_role.yml index 71f4f0c9527..f3e695c1fba 100644 --- a/test/integration/targets/include_import/role/test_include_role.yml +++ b/test/integration/targets/include_import/role/test_include_role.yml @@ -69,10 +69,7 @@ name: role3 tasks_from: vartest.yml vars_from: role3vars.yml - private: no - # FIXME Setting private: no in previous task does not make the variables - # available to the play - name: Assert that variables defined in previous task are available to play assert: that: