able to load collections but they don't do anything because no actionmodulemixin, need to tweak how this works

pull/715/head
Steven Robertson 5 years ago
parent 74b7934e37
commit e99d63f4fc

@ -74,7 +74,7 @@ except ImportError:
LOG = logging.getLogger(__name__)
try:
class ActionModuleMixin(ansible.plugins.action.ActionBase):
"""
The Mitogen-patched PluginLoader dynamically mixes this into every action
@ -519,3 +519,8 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase):
'stdout_lines': stdout_text.splitlines(),
'stderr': stderr,
}
except AttributeError:
# if we're loading collections, there is no ActionBase
# collections are implemented via an import hook
# https://github.com/ansible/ansible/pull/52194/files
pass

@ -40,6 +40,7 @@ except ImportError:
import mitogen.core
import ansible_mitogen.affinity
import ansible_mitogen.loaders
# import epdb; epdb.set_trace()
import ansible_mitogen.mixins
import ansible_mitogen.process
@ -137,7 +138,12 @@ def wrap_action_loader__get(name, *args, **kwargs):
klass = ansible_mitogen.loaders.action_loader__get(name, **get_kwargs)
if klass:
try:
bases = (ansible_mitogen.mixins.ActionModuleMixin, klass)
except AttributeError:
# if we're loading a collection, there's no ActionModuleMixin
bases = (klass,)
adorned_klass = type(str(name), bases, {})
if kwargs.get('class_only'):
return adorned_klass

Loading…
Cancel
Save