mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
refactoring async
- centralized skipping - also fixed module name broken by previous refactor - let action modules handle async processing - moved async into base action class's module exec - action plugins can now run final action as async - actually skip copy if base skips - fixed normal for new paths - ensure internal stat is never async - default poll to 10 as per docs - added hint for callback fix on poll - restructured late tmp, now a pipeline query - moving action handler to connection as networking does - fixed network assumption invocation is always passed - centralized key cleanup, normalized internal var - _supress_tmpdir_delete now in _ansible_xxx and gets removed from results - delay internal key removal till after we use em - nicer tmp removing, using existing methods - moved cleanup tmp flag to mking tmp func
This commit is contained in:
parent
22db51f15c
commit
c86a17b7a0
22 changed files with 254 additions and 371 deletions
|
@ -32,11 +32,15 @@ class ActionModule(ActionBase):
|
|||
|
||||
def run(self, tmp=None, task_vars=None):
|
||||
''' handler for package operations '''
|
||||
if task_vars is None:
|
||||
task_vars = dict()
|
||||
|
||||
self._supports_check_mode = True
|
||||
self._supports_async = True
|
||||
|
||||
result = super(ActionModule, self).run(tmp, task_vars)
|
||||
|
||||
if result.get('skipped', False):
|
||||
return result
|
||||
|
||||
module = self._task.args.get('use', 'auto')
|
||||
|
||||
if module == 'auto':
|
||||
|
@ -59,17 +63,16 @@ class ActionModule(ActionBase):
|
|||
if module not in self._shared_loader_obj.module_loader:
|
||||
result['failed'] = True
|
||||
result['msg'] = 'Could not find a module for %s.' % module
|
||||
return result
|
||||
else:
|
||||
# run the 'package' module
|
||||
new_module_args = self._task.args.copy()
|
||||
if 'use' in new_module_args:
|
||||
del new_module_args['use']
|
||||
|
||||
# run the 'package' module
|
||||
new_module_args = self._task.args.copy()
|
||||
if 'use' in new_module_args:
|
||||
del new_module_args['use']
|
||||
|
||||
display.vvvv("Running %s" % module)
|
||||
result.update(self._execute_module(module_name=module, module_args=new_module_args, task_vars=task_vars))
|
||||
return result
|
||||
display.vvvv("Running %s" % module)
|
||||
result.update(self._execute_module(module_name=module, module_args=new_module_args, task_vars=task_vars, wrap_async=self._task.async))
|
||||
else:
|
||||
result['failed'] = True
|
||||
result['msg'] = 'Could not detect which package manager to use. Try gathering facts or setting the "use" option.'
|
||||
return result
|
||||
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue