Closed pavelion closed 3 years ago
I have same issue
ERROR! Unexpected Exception, this is probably a bug: No module named 'ansible.plugins.action.network' the full traceback was:
Traceback (most recent call last):
File "/usr/local/bin/ansible-playbook", line 123, in
I also have this issue:
ERROR! Unexpected Exception, this is probably a bug: No module named 'ansible.plugins.action.network'
the full traceback was:
Traceback (most recent call last):
File "/Users/ulmer/.pyenv/versions/3.8.0/bin/ansible-playbook", line 123, in <module>
exit_code = cli.run()
File "/Users/ulmer/.pyenv/versions/3.8.0/lib/python3.8/site-packages/ansible/cli/playbook.py", line 128, in run
results = pbex.run()
File "/Users/ulmer/.pyenv/versions/3.8.0/lib/python3.8/site-packages/ansible/executor/playbook_executor.py", line 169, in run
result = self._tqm.run(play=play)
File "/Users/ulmer/.pyenv/versions/3.8.0/lib/python3.8/site-packages/ansible/executor/task_queue_manager.py", line 280, in run
play_return = strategy.run(iterator, play_context)
File "/Users/ulmer/.pyenv/versions/3.8.0/lib/python3.8/site-packages/ansible/plugins/strategy/linear.py", line 266, in run
action = action_loader.get(task.action, class_only=True, collection_list=task.collections)
File "/Users/ulmer/.pyenv/versions/3.8.0/lib/python3.8/site-packages/ansible/plugins/loader.py", line 780, in get
return self.get_with_context(name, *args, **kwargs).object
File "/Users/ulmer/.pyenv/versions/3.8.0/lib/python3.8/site-packages/ansible/plugins/loader.py", line 800, in get_with_context
self._module_cache[path] = self._load_module_source(name, path)
File "/Users/ulmer/.pyenv/versions/3.8.0/lib/python3.8/site-packages/ansible/plugins/loader.py", line 764, in _load_module_source
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/ulmer/.ansible/collections/ansible_collections/mellanox/onyx/plugins/action/onyx_config.py", line 22, in <module>
from ansible.plugins.action.network import ActionModule as ActionNetworkModule
ModuleNotFoundError: No module named 'ansible.plugins.action.network'
Hmmm... So if I move the mellanox/onyx/plugins/action/ directory out of the way, then it will work with a fully-qualified module name. Putting a collections section in the playbook does not let me use the short name. So it seems that this file is used for the module redirection somehow, but brakes everything because it can't be loaded...
I have looked for a couple of hours and can't figure out how to fix this the right way (I've never written an action plugin). I hope this bit is helpful to someone else.
I have been able to solve this error by replacing in file "/root/ansible-cct/collections/ansible_collections/mellanox/onyx/plugins/action/onyx_config.py", line 22
from ansible.plugins.action.network import ActionModule as ActionNetworkModule
with
from ansible_collections.ansible.netcommon.plugins.action.network import ActionModule as ActionNetworkModule
You are correct! I’ll be testing that on a real switch on Monday, and hopefully it will be integrated by the maintainer soon!
-- Stephen
On Nov 25, 2020, at 8:33 AM, Bogdan Cristea notifications@github.com wrote:
I have been able to solve this error by replacing in file "/root/ansible-cct/collections/ansible_collections/mellanox/onyx/plugins/action/onyx_config.py", line 22
from ansible.plugins.action.network import ActionModule as ActionNetworkModule
with
from ansible_collections.ansible.netcommon.plugins.action.network import ActionModule as ActionNetworkModule
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ansible-collections/mellanox.onyx/issues/10#issuecomment-733708799, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJNCUCSIPAF4WVNRFB55RUTSRUBSDANCNFSM4SJDIOQQ.
Following cristeab's recommendation and editing the .../collections/ansible_collections/mellanox/onyx/plugins/action/onyx_config.py, line 22 with:
from ansible_collections.ansible.netcommon.plugins.action.network import ActionModule as ActionNetworkModule
made everything work amazingly well again!
SUMMARY
mellanox.onyx.plugins.action.onyx_config imports ansible.plugins.action.network which is no longer available in Ansible 2.10
ISSUE TYPE
COMPONENT NAME
mellanox.onyx.plugins.action.onyx_config
ANSIBLE VERSION
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS