From 9ed3e2ef486347fe5e92bbec7c6ad69cf0629871 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Fri, 12 Jun 2015 15:06:11 -0500 Subject: [PATCH] Display a warning when using a deprecated module --- lib/ansible/plugins/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ansible/plugins/__init__.py b/lib/ansible/plugins/__init__.py index 8d23ae796cb..bbbe0bd7950 100644 --- a/lib/ansible/plugins/__init__.py +++ b/lib/ansible/plugins/__init__.py @@ -247,6 +247,14 @@ class PluginLoader: for alias_name in ('_%s' % n for n in potential_names): # We've already cached all the paths at this point if alias_name in self._plugin_path_cache: + if not os.path.islink(self._plugin_path_cache[alias_name]): + d = Display() + d.warning('%s has been deprecated, which means ' + 'it is kept for backwards compatibility ' + 'but usage is discouraged. The module ' + 'documentation details page may explain ' + 'more about this rationale.' % + name.lstrip('_')) return self._plugin_path_cache[alias_name] return None