[2.10] Improve deprecations (#72871)
* Improve deprecations (#72697)
* Remove space before comma in '... bla , use ...'
* 'why' is inserted in the middle of a sentence, between two commas.
* Make deprecations from base.yml show source ansible-core.
* Add changelog fragment.
* Improve some more 'why's.
* Add PR URL to fragment.
(cherry picked from commit f569d80fde
)
* 2.10 is ansible-base, not ansible-core
This commit is contained in:
parent
856a932ca0
commit
138a5bd2d6
4 changed files with 21 additions and 4 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "Improve Ansible config deprecations to show the source of the deprecation (ansible-base). Also remove space before a comma in config deprecations (https://github.com/ansible/ansible/pull/72697)."
|
|
@ -98,7 +98,7 @@ class CLI(with_metaclass(ABCMeta, object)):
|
|||
ver = deprecated[1].get('version')
|
||||
date = deprecated[1].get('date')
|
||||
collection_name = deprecated[1].get('collection_name')
|
||||
display.deprecated("%s option, %s %s" % (name, why, alt),
|
||||
display.deprecated("%s option, %s%s" % (name, why, alt),
|
||||
version=ver, date=date, collection_name=collection_name)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
ALLOW_WORLD_READABLE_TMPFILES:
|
||||
name: Allow world-readable temporary files
|
||||
deprecated:
|
||||
why: moved to a per plugin approach that is more flexible.
|
||||
why: moved to a per plugin approach that is more flexible
|
||||
version: "2.14"
|
||||
alternatives: mostly the same config will work, but now controlled from the plugin itself and not using the general constant.
|
||||
default: False
|
||||
|
@ -721,7 +721,7 @@ DEFAULT_HASH_BEHAVIOUR:
|
|||
ini:
|
||||
- {key: hash_behaviour, section: defaults}
|
||||
deprecated:
|
||||
why: This feature is fragile and not portable, leading to continual confusion and misuse
|
||||
why: this feature is fragile and not portable, leading to continual confusion and misuse
|
||||
version: "2.13"
|
||||
alternatives: the ``combine`` filter explicitly
|
||||
DEFAULT_HOST_LIST:
|
||||
|
@ -1782,7 +1782,7 @@ PLUGIN_FILTERS_CFG:
|
|||
- key: plugin_filters_cfg
|
||||
section: default
|
||||
deprecated:
|
||||
why: Specifying "plugin_filters_cfg" under the "default" section is deprecated
|
||||
why: specifying "plugin_filters_cfg" under the "default" section is deprecated
|
||||
version: "2.12"
|
||||
alternatives: the "defaults" section instead
|
||||
- key: plugin_filters_cfg
|
||||
|
|
|
@ -262,6 +262,20 @@ def find_ini_config_file(warnings=None):
|
|||
return path
|
||||
|
||||
|
||||
def _add_base_defs_deprecations(base_defs):
|
||||
'''Add deprecation source 'ansible.builtin' to deprecations in base.yml'''
|
||||
def process(entry):
|
||||
if 'deprecated' in entry:
|
||||
entry['deprecated']['collection_name'] = 'ansible.builtin'
|
||||
|
||||
for dummy, data in base_defs.items():
|
||||
process(data)
|
||||
for section in ('ini', 'env', 'vars'):
|
||||
if section in data:
|
||||
for entry in data[section]:
|
||||
process(entry)
|
||||
|
||||
|
||||
class ConfigManager(object):
|
||||
|
||||
DEPRECATED = []
|
||||
|
@ -277,6 +291,7 @@ class ConfigManager(object):
|
|||
self.data = ConfigData()
|
||||
|
||||
self._base_defs = self._read_config_yaml_file(defs_file or ('%s/base.yml' % os.path.dirname(__file__)))
|
||||
_add_base_defs_deprecations(self._base_defs)
|
||||
|
||||
if self._config_file is None:
|
||||
# set config using ini
|
||||
|
|
Loading…
Add table
Reference in a new issue