mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Port action plugins to global display
This commit is contained in:
parent
186e034515
commit
4c7128da17
4 changed files with 68 additions and 42 deletions
|
@ -19,6 +19,13 @@ __metaclass__ = type
|
|||
|
||||
from ansible.plugins.action import ActionBase
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
display = display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
||||
|
@ -41,7 +48,7 @@ class ActionModule(ActionBase):
|
|||
|
||||
if module == 'auto':
|
||||
facts = self._execute_module(module_name='setup', module_args=dict(filter='ansible_pkg_mgr'), task_vars=task_vars)
|
||||
self._display.debug("Facts %s" % facts)
|
||||
display.debug("Facts %s" % facts)
|
||||
if 'failed' not in facts:
|
||||
module = getattr(facts['ansible_facts'], 'ansible_pkg_mgr', 'auto')
|
||||
|
||||
|
@ -57,7 +64,7 @@ class ActionModule(ActionBase):
|
|||
if 'use' in new_module_args:
|
||||
del new_module_args['use']
|
||||
|
||||
self._display.vvvv("Running %s" % module)
|
||||
display.vvvv("Running %s" % module)
|
||||
result.update(self._execute_module(module_name=module, module_args=new_module_args, task_vars=task_vars))
|
||||
return result
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue