From 0e7b470a0139295db16683486d427597b4afdbf1 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Tue, 21 Aug 2018 12:57:06 -0700 Subject: [PATCH] Remove deprecated tags config option (#44479) * Remove deprecated tags config option * wordsmith porting guide entry acozine via github --- .../fragments/remove-merge-multiple-tags.yaml | 8 ++++++++ .../rst/porting_guides/porting_guide_2.7.rst | 14 ++++++++++++++ lib/ansible/cli/__init__.py | 14 -------------- lib/ansible/config/base.yml | 12 ------------ 4 files changed, 22 insertions(+), 26 deletions(-) create mode 100644 changelogs/fragments/remove-merge-multiple-tags.yaml diff --git a/changelogs/fragments/remove-merge-multiple-tags.yaml b/changelogs/fragments/remove-merge-multiple-tags.yaml new file mode 100644 index 00000000000..ca2525780dd --- /dev/null +++ b/changelogs/fragments/remove-merge-multiple-tags.yaml @@ -0,0 +1,8 @@ +--- +removed_features: +- The configuration toggle, ``merge_multiple_cli_tags``, has been removed. + This setting controlled whether specifying ``--tags`` or ``--skip-tags`` + multiple times on the commandline would merge the specified tags or use the + old behaviour of overwriting the previous entry. The overwriting behaviour + was deprecated in 2.3 and the default value of the config option became merge + in 2.4. diff --git a/docs/docsite/rst/porting_guides/porting_guide_2.7.rst b/docs/docsite/rst/porting_guides/porting_guide_2.7.rst index 4ea30af876f..6947a221ddc 100644 --- a/docs/docsite/rst/porting_guides/porting_guide_2.7.rst +++ b/docs/docsite/rst/porting_guides/porting_guide_2.7.rst @@ -14,6 +14,20 @@ This document is part of a collection on porting. The complete list of porting g .. contents:: Topics +Command Line +============ + +If you specify ``--tags`` or ``--skip-tags`` multiple times on the command line, Ansible will merge the specified +tags together. In previous versions of Ansible, you could set ``merge_multiple_cli_tags`` to ``False`` +if you wanted to keep only the last-specified ``--tags``. This config +option existed for backwards compatibility. The overwriting behavior was deprecated in 2.3 and +the default behavior was changed in 2.4. Ansible-2.7 removes the config option; multiple +``--tags`` are now always merged. + +If you have a shell script that depends on setting ``merge_multiple_cli_tags`` to ``False``, please upgrade your script +so it only adds the ``--tags`` you actually want before upgrading to Ansible-2.7. + + Python Compatibility ==================== diff --git a/lib/ansible/cli/__init__.py b/lib/ansible/cli/__init__.py index b896445d556..5ab83601b89 100644 --- a/lib/ansible/cli/__init__.py +++ b/lib/ansible/cli/__init__.py @@ -583,13 +583,6 @@ class CLI(with_metaclass(ABCMeta, object)): # optparse defaults does not do what's expected self.options.tags = ['all'] if hasattr(self.options, 'tags') and self.options.tags: - if not C.MERGE_MULTIPLE_CLI_TAGS: - if len(self.options.tags) > 1: - display.deprecated('Specifying --tags multiple times on the command line currently uses the last specified value. ' - 'In 2.4, values will be merged instead. Set merge_multiple_cli_tags=True in ansible.cfg to get this behavior now.', - version=2.5, removed=False) - self.options.tags = [self.options.tags[-1]] - tags = set() for tag_set in self.options.tags: for tag in tag_set.split(u','): @@ -598,13 +591,6 @@ class CLI(with_metaclass(ABCMeta, object)): # process skip_tags if hasattr(self.options, 'skip_tags') and self.options.skip_tags: - if not C.MERGE_MULTIPLE_CLI_TAGS: - if len(self.options.skip_tags) > 1: - display.deprecated('Specifying --skip-tags multiple times on the command line currently uses the last specified value. ' - 'In 2.4, values will be merged instead. Set merge_multiple_cli_tags=True in ansible.cfg to get this behavior now.', - version=2.5, removed=False) - self.options.skip_tags = [self.options.skip_tags[-1]] - skip_tags = set() for tag_set in self.options.skip_tags: for tag in tag_set.split(u','): diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 5ce0229180f..a65d70e9859 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -1459,18 +1459,6 @@ MAX_FILE_SIZE_FOR_DIFF: ini: - {key: max_diff_size, section: defaults} type: int -MERGE_MULTIPLE_CLI_TAGS: - name: Merge 'tags' options - default: True - description: - - "This allows changing how multiple --tags and --skip-tags arguments are handled on the command line. - In Ansible up to and including 2.3, specifying --tags more than once will only take the last value of --tags." - - "Setting this config value to True will mean that all of the --tags options will be merged together. The same holds true for --skip-tags." - env: [{name: ANSIBLE_MERGE_MULTIPLE_CLI_TAGS}] - ini: - - {key: merge_multiple_cli_tags, section: defaults} - type: bool - version_added: "2.3" NETWORK_GROUP_MODULES: name: Network module families default: [eos, nxos, ios, iosxr, junos, enos, ce, vyos, sros, dellos9, dellos10, dellos6, asa, aruba, aireos, bigip, ironware, onyx, netconf]