able to load collection but the mitogen master proc was unable to serve it

pull/715/head
Steven Robertson 4 years ago
parent e99d63f4fc
commit ddc1eebec8

@ -75,7 +75,14 @@ except ImportError:
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
try: try:
class ActionModuleMixin(ansible.plugins.action.ActionBase): BaseActionClass = ansible.plugins.action.ActionBase
except AttributeError:
# collections were added in https://github.com/ansible/ansible/pull/52194/files
# monkeypatching collections since they don't have an actionBase
BaseActionClass = type('DummyActionBase', (object,), {})
class ActionModuleMixin(BaseActionClass):
""" """
The Mitogen-patched PluginLoader dynamically mixes this into every action The Mitogen-patched PluginLoader dynamically mixes this into every action
class that Ansible attempts to load. It exists to override all the class that Ansible attempts to load. It exists to override all the
@ -519,8 +526,3 @@ try:
'stdout_lines': stdout_text.splitlines(), 'stdout_lines': stdout_text.splitlines(),
'stderr': stderr, '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

@ -138,12 +138,7 @@ def wrap_action_loader__get(name, *args, **kwargs):
klass = ansible_mitogen.loaders.action_loader__get(name, **get_kwargs) klass = ansible_mitogen.loaders.action_loader__get(name, **get_kwargs)
if klass: if klass:
try:
bases = (ansible_mitogen.mixins.ActionModuleMixin, klass) 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, {}) adorned_klass = type(str(name), bases, {})
if kwargs.get('class_only'): if kwargs.get('class_only'):
return adorned_klass return adorned_klass

Loading…
Cancel
Save