Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'module' object has no attribute 'ActionBase' #982

Open
mkhon opened this issue Jan 28, 2023 · 0 comments
Open

AttributeError: 'module' object has no attribute 'ActionBase' #982

mkhon opened this issue Jan 28, 2023 · 0 comments
Labels
affects-0.2 Issues related to 0.2.X Mitogen releases bug Code feature that hinders desired execution outcome

Comments

@mkhon
Copy link

mkhon commented Jan 28, 2023

I am using mitogen from tag v0.2.10 (which is identical to 0.2-release HEAD)

$ ansible --version      
/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.exceptions import InvalidSignature
ansible 2.9.27
  config file = /home/spdev_svc_sdpss_jenkinsbuild/workspace/Surfbeam_2_Jenkins/SDP-SS/DHCP_FR_CI_PIPELINE/dhcp_fr_deploy_ci/ansible.cfg
  configured module search path = [u'/home/spdev_svc_sdpss_jenkinsbuild/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.18 (default, Mar  8 2021, 13:02:45) [GCC 9.3.0]
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.4 LTS
Release:	20.04
Codename:	focal

Playbooks no longer run:

PLAY [all] ***************************************************************************************************
ERROR! Unexpected Exception, this is probably a bug: 'module' object has no attribute 'ActionBase'
the full traceback was:

Traceback (most recent call last):
  File "/usr/local/bin/ansible-playbook", line 123, in <module>
    exit_code = cli.run()
  File "/usr/local/lib/python2.7/dist-packages/ansible/cli/playbook.py", line 128, in run
    results = pbex.run()
  File "/usr/local/lib/python2.7/dist-packages/ansible/executor/playbook_executor.py", line 169, in run
    result = self._tqm.run(play=play)
  File "/usr/local/lib/python2.7/dist-packages/ansible/executor/task_queue_manager.py", line 261, in run
    strategy = strategy_loader.get(new_play.strategy, self)
  File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/loader.py", line 552, in get
    self._module_cache[path] = self._load_module_source(name, path)
  File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/loader.py", line 530, in _load_module_source
    module = imp.load_source(to_native(full_name), to_native(path), module_file)
  File "/home/spdev_svc_sdpss_jenkinsbuild/workspace/Surfbeam_2_Jenkins/SDP-SS/DHCP_FR_CI_PIPELINE/dhcp_fr_deploy_ci/mitogen/ansible_mitogen/plugins/strategy/mitogen_linear.py", line 56, in <module>
    import ansible_mitogen.strategy
  File "/home/spdev_svc_sdpss_jenkinsbuild/workspace/Surfbeam_2_Jenkins/SDP-SS/DHCP_FR_CI_PIPELINE/dhcp_fr_deploy_ci/mitogen/ansible_mitogen/strategy.py", line 43, in <module>
    import ansible_mitogen.mixins
  File "/home/spdev_svc_sdpss_jenkinsbuild/workspace/Surfbeam_2_Jenkins/SDP-SS/DHCP_FR_CI_PIPELINE/dhcp_fr_deploy_ci/mitogen/ansible_mitogen/mixins.py", line 78, in <module>
    class ActionModuleMixin(ansible.plugins.action.ActionBase):
AttributeError: 'module' object has no attribute 'ActionBase'

If I change the import in mitogen/ansible_mitogen/mixins.py as follows everything works as expected:

diff --git a/ansible_mitogen/mixins.py b/ansible_mitogen/mixins.py
index 7672618d..a21289a3 100644
--- a/ansible_mitogen/mixins.py
+++ b/ansible_mitogen/mixins.py
@@ -44,7 +44,7 @@ from ansible.parsing.utils.jsonify import jsonify
 import ansible
 import ansible.constants
 import ansible.plugins
-import ansible.plugins.action
+from ansible.plugins.action import ActionBase
 
 import mitogen.core
 import mitogen.select
@@ -75,7 +75,7 @@ except ImportError:
 LOG = logging.getLogger(__name__)
 
 
-class ActionModuleMixin(ansible.plugins.action.ActionBase):
+class ActionModuleMixin(ActionBase):
     """
     The Mitogen-patched PluginLoader dynamically mixes this into every action
     class that Ansible attempts to load. It exists to override all the
@mkhon mkhon added affects-0.2 Issues related to 0.2.X Mitogen releases bug Code feature that hinders desired execution outcome labels Jan 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-0.2 Issues related to 0.2.X Mitogen releases bug Code feature that hinders desired execution outcome
Projects
None yet
Development

No branches or pull requests

1 participant