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.
This commit is contained in:
parent
b464d18fd1
commit
f569d80fde
4 changed files with 28 additions and 11 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "Improve Ansible config deprecations to show the source of the deprecation (ansible-core). 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')
|
ver = deprecated[1].get('version')
|
||||||
date = deprecated[1].get('date')
|
date = deprecated[1].get('date')
|
||||||
collection_name = deprecated[1].get('collection_name')
|
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)
|
version=ver, date=date, collection_name=collection_name)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
ALLOW_WORLD_READABLE_TMPFILES:
|
ALLOW_WORLD_READABLE_TMPFILES:
|
||||||
name: Allow world-readable temporary files
|
name: Allow world-readable temporary files
|
||||||
deprecated:
|
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"
|
version: "2.14"
|
||||||
alternatives: mostly the same config will work, but now controlled from the plugin itself and not using the general constant.
|
alternatives: mostly the same config will work, but now controlled from the plugin itself and not using the general constant.
|
||||||
default: False
|
default: False
|
||||||
|
@ -43,7 +43,7 @@ ANSIBLE_COW_ACCEPTLIST:
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_COW_WHITELIST
|
- name: ANSIBLE_COW_WHITELIST
|
||||||
deprecated:
|
deprecated:
|
||||||
why: Normalizing names to new standard.
|
why: normalizing names to new standard
|
||||||
version: "2.15"
|
version: "2.15"
|
||||||
alternatives: 'ANSIBLE_COW_ACCEPTLIST'
|
alternatives: 'ANSIBLE_COW_ACCEPTLIST'
|
||||||
- name: ANSIBLE_COW_ACCEPTLIST
|
- name: ANSIBLE_COW_ACCEPTLIST
|
||||||
|
@ -52,7 +52,7 @@ ANSIBLE_COW_ACCEPTLIST:
|
||||||
- key: cow_whitelist
|
- key: cow_whitelist
|
||||||
section: defaults
|
section: defaults
|
||||||
deprecated:
|
deprecated:
|
||||||
why: Normalizing names to new standard.
|
why: normalizing names to new standard
|
||||||
version: "2.15"
|
version: "2.15"
|
||||||
alternatives: 'cowsay_enabled_stencils'
|
alternatives: 'cowsay_enabled_stencils'
|
||||||
- key: cowsay_enabled_stencils
|
- key: cowsay_enabled_stencils
|
||||||
|
@ -438,7 +438,7 @@ COMMAND_WARNINGS:
|
||||||
type: boolean
|
type: boolean
|
||||||
version_added: "1.8"
|
version_added: "1.8"
|
||||||
deprecated:
|
deprecated:
|
||||||
why: The command warnings feature is being removed.
|
why: the command warnings feature is being removed
|
||||||
version: "2.14"
|
version: "2.14"
|
||||||
LOCALHOST_WARNING:
|
LOCALHOST_WARNING:
|
||||||
name: Warning when using implicit inventory with only localhost
|
name: Warning when using implicit inventory with only localhost
|
||||||
|
@ -574,7 +574,7 @@ CALLABLE_ACCEPT_LIST:
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_CALLABLE_WHITELIST
|
- name: ANSIBLE_CALLABLE_WHITELIST
|
||||||
deprecated:
|
deprecated:
|
||||||
why: Normalizing names to new standard.
|
why: normalizing names to new standard
|
||||||
version: "2.15"
|
version: "2.15"
|
||||||
alternatives: 'ANSIBLE_CALLABLE_ENABLED'
|
alternatives: 'ANSIBLE_CALLABLE_ENABLED'
|
||||||
- name: ANSIBLE_CALLABLE_ENABLED
|
- name: ANSIBLE_CALLABLE_ENABLED
|
||||||
|
@ -583,7 +583,7 @@ CALLABLE_ACCEPT_LIST:
|
||||||
- key: callable_whitelist
|
- key: callable_whitelist
|
||||||
section: defaults
|
section: defaults
|
||||||
deprecated:
|
deprecated:
|
||||||
why: Normalizing names to new standard.
|
why: normalizing names to new standard
|
||||||
version: "2.15"
|
version: "2.15"
|
||||||
alternatives: 'callable_enabled'
|
alternatives: 'callable_enabled'
|
||||||
- key: callable_enabled
|
- key: callable_enabled
|
||||||
|
@ -617,7 +617,7 @@ CALLBACKS_ENABLED:
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_CALLBACK_WHITELIST
|
- name: ANSIBLE_CALLBACK_WHITELIST
|
||||||
deprecated:
|
deprecated:
|
||||||
why: Normalizing names to new standard.
|
why: normalizing names to new standard
|
||||||
version: "2.15"
|
version: "2.15"
|
||||||
alternatives: 'ANSIBLE_CALLBACKS_ENABLED'
|
alternatives: 'ANSIBLE_CALLBACKS_ENABLED'
|
||||||
- name: ANSIBLE_CALLBACKS_ENABLED
|
- name: ANSIBLE_CALLBACKS_ENABLED
|
||||||
|
@ -626,7 +626,7 @@ CALLBACKS_ENABLED:
|
||||||
- key: callback_whitelist
|
- key: callback_whitelist
|
||||||
section: defaults
|
section: defaults
|
||||||
deprecated:
|
deprecated:
|
||||||
why: Normalizing names to new standard.
|
why: normalizing names to new standard
|
||||||
version: "2.15"
|
version: "2.15"
|
||||||
alternatives: 'callback_enabled'
|
alternatives: 'callback_enabled'
|
||||||
- key: callbacks_enabled
|
- key: callbacks_enabled
|
||||||
|
@ -782,7 +782,7 @@ DEFAULT_HASH_BEHAVIOUR:
|
||||||
ini:
|
ini:
|
||||||
- {key: hash_behaviour, section: defaults}
|
- {key: hash_behaviour, section: defaults}
|
||||||
deprecated:
|
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"
|
version: "2.13"
|
||||||
alternatives: the ``combine`` filter explicitly
|
alternatives: the ``combine`` filter explicitly
|
||||||
DEFAULT_HOST_LIST:
|
DEFAULT_HOST_LIST:
|
||||||
|
@ -1839,7 +1839,7 @@ PLUGIN_FILTERS_CFG:
|
||||||
- key: plugin_filters_cfg
|
- key: plugin_filters_cfg
|
||||||
section: default
|
section: default
|
||||||
deprecated:
|
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"
|
version: "2.12"
|
||||||
alternatives: the "defaults" section instead
|
alternatives: the "defaults" section instead
|
||||||
- key: plugin_filters_cfg
|
- key: plugin_filters_cfg
|
||||||
|
|
|
@ -266,6 +266,20 @@ def find_ini_config_file(warnings=None):
|
||||||
return path
|
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):
|
class ConfigManager(object):
|
||||||
|
|
||||||
DEPRECATED = []
|
DEPRECATED = []
|
||||||
|
@ -281,6 +295,7 @@ class ConfigManager(object):
|
||||||
self.data = ConfigData()
|
self.data = ConfigData()
|
||||||
|
|
||||||
self._base_defs = self._read_config_yaml_file(defs_file or ('%s/base.yml' % os.path.dirname(__file__)))
|
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:
|
if self._config_file is None:
|
||||||
# set config using ini
|
# set config using ini
|
||||||
|
|
Loading…
Reference in a new issue