Revert "Configurable list of facts modules (#31783)" (#40022)

This reverts commit 95655fae5c.
This commit is contained in:
Toshio Kuratomi 2018-05-14 13:46:14 -07:00 committed by Matt Davis
parent abb353290c
commit 38ab36a625
12 changed files with 3 additions and 173 deletions

View file

@ -1,41 +0,0 @@
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from collections import MutableMapping
from ansible import constants as C
from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None):
''' handler for package operations '''
self._supports_check_mode = True
self._supports_async = True
result = super(ActionModule, self).run(tmp, task_vars)
result['ansible_facts'] = {}
for fact_module in C.config.get_config_value('FACTS_MODULES', variables=task_vars):
mod_args = task_vars.get('ansible_facts_modules', {}).get(fact_module, {})
if isinstance(mod_args, MutableMapping):
mod_args.update(self._task.args.copy())
else:
mod_args = self._task.args.copy()
if fact_module != 'setup':
del mod_args['gather_subset']
self._display.vvvv("Running %s" % fact_module)
result.update(self._execute_module(module_name=fact_module, module_args=mod_args, task_vars=task_vars, wrap_async=self._task.async_val))
# tell executor facts were gathered
result['ansible_facts']['_ansible_facts_gathered'] = True
return result

View file

@ -328,7 +328,7 @@ class PluginLoader:
from ansible.vars.reserved import is_reserved_name
plugin = self._find_plugin(name, mod_type=mod_type, ignore_deprecated=ignore_deprecated, check_aliases=check_aliases)
if plugin and self.package == 'ansible.modules' and name not in ('gather_facts',) and is_reserved_name(name):
if plugin and self.package == 'ansible.modules' and is_reserved_name(name):
raise AnsibleError(
'Module "%s" shadows the name of a reserved keyword. Please rename or remove this module. Found at %s' % (name, plugin)
)