From c027ad943e6c17387ab75e864170e3665a8e6635 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 14 Sep 2017 16:56:52 -0400 Subject: [PATCH] remove dupe deprecation on config (#30364) * remove dupe deprecation on config also move failed typing to same place to use 'standard' display vs hack. --- lib/ansible/cli/__init__.py | 6 +++++- lib/ansible/config/base.yml | 2 +- lib/ansible/config/manager.py | 8 -------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/ansible/cli/__init__.py b/lib/ansible/cli/__init__.py index 3e34d7ac7e..fb1eb0f585 100644 --- a/lib/ansible/cli/__init__.py +++ b/lib/ansible/cli/__init__.py @@ -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_@) diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 70bb5abe5f..0c4e6cb263 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -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 diff --git a/lib/ansible/config/manager.py b/lib/ansible/config/manager.py index 5270a4fa66..2756d7cdc9 100644 --- a/lib/ansible/config/manager.py +++ b/lib/ansible/config/manager.py @@ -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))