1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

remove dupe deprecation on config (#30364)

* remove dupe deprecation on config

also move failed typing to same place to use 'standard' display vs hack.
This commit is contained in:
Brian Coca 2017-09-14 16:56:52 -04:00 committed by GitHub
parent 6730f81024
commit c027ad943e
3 changed files with 6 additions and 10 deletions

View file

@ -168,7 +168,7 @@ class CLI(with_metaclass(ABCMeta, object)):
else:
display.v(u"No config file found; using defaults")
# warn about deprecated options
# warn about deprecated config options
for deprecated in C.config.DEPRECATED:
name = deprecated[0]
why = deprecated[1]['why']
@ -179,6 +179,10 @@ class CLI(with_metaclass(ABCMeta, object)):
ver = deprecated[1]['version']
display.deprecated("%s option, %s %s" % (name, why, alt), version=ver)
# warn about typing issues with configuration entries
for unable in C.config.UNABLE:
display.warning("Unable to set correct type for configuration entry: %s" % unable)
@staticmethod
def split_vault_id(vault_id):
# return (before_@, after_@)

View file

@ -698,7 +698,7 @@ DEFAULT_HOST_LIST:
deprecated:
why: The key is misleading as it can also be a list of hosts, a directory or a list of paths
version: "2.8"
alternatives: inventory
alternatives: "[defaults]\ninventory=/path/to/file|dir"
- key: inventory
section: defaults
type: pathlist

View file

@ -373,11 +373,3 @@ class ConfigManager(object):
# set the constant
self.data.update_setting(Setting(config, value, origin, defs[config].get('type', 'string')))
# FIXME: find better way to do this by passing back to where display is available
if self.UNABLE:
sys.stderr.write("Unable to set correct type for:\n\t%s\n" % '\n\t'.join(self.UNABLE))
if self.DEPRECATED:
for k, reason in self.DEPRECATED:
sys.stderr.write("[DEPRECATED] %(k)s: %(why)s. It will be removed in %(version)s. As alternative use one of [%(alternatives)s]\n"
% dict(k=k, **reason))