Open kevinkirkup opened 4 years ago
I've tried a number of different thing to figure this out without any luck. Any help would be appreciated.
Set: strategy: linear
for this role and seeing a similar error from Ansible.
TASK [kafka_topics : Create Topics] ****************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'retrying'
failed: [kato-virtual-pod-26-openstack1] (item={'key': 'containers_bgp_status', 'value': {'state': 'present', 'name': 'containers_bgp_status', 'partitions': 48, 'replication_factor': 1, 'config': {'retention.ms': 604800000}}}) => {"ansible_loop_var": "item", "changed": false, "item": {"key": "containers_bgp_status", "value": {"config": {"retention.ms": 604800000}, "name": "containers_bgp_status", "partitions": 48, "replication_factor": 1, "state": "present"}}, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 114, in <module>\n File \"<stdin>\", line 106, in _ansiballz_main\n File \"<stdin>\", line 49, in invoke_module\n File \"/usr/lib/python3.6/imp.py\", line 235, in load_module\n return load_source(name, filename, file)\n File \"/usr/lib/python3.6/imp.py\", line 170, in load_source\n module = _exec(spec, sys.modules[name])\n File \"<frozen importlib._bootstrap>\", line 618, in _exec\n File \"<frozen importlib._bootstrap_external>\", line 678, in exec_module\n File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n File \"/tmp/ansible_kafka_topic_payload_5xu4r5v6/__main__.py\", line 66, in <module>\nModuleNotFoundError: No module named 'retrying'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'retrying'
Import is working:
>>> import retrying
>>> os.path.abspath(retrying.__file__)
'/usr/local/lib/python3.6/dist-packages/retrying.py'
But isn't in sys.module
:
def load_source(name, pathname, file=None):
loader = _LoadSourceCompatibility(name, pathname, file)
spec = util.spec_from_file_location(name, pathname, loader=loader)
if name in sys.modules:
module = _exec(spec, sys.modules[name]) <------------ Failing here
I was able to resolve this by manually installing the package on the target host. I'm was thinking that should be covered by mitogen or Ansible, but maybe not.
You're correct, Ansible requires external python packages to be installed in order for it to use them. Glad you got your issue worked out though!
I think what confused me was the comment in #724. It made it sound like Mitogen would install it on the remote host.
I just checked the comment you mentioned; you're correct in that Mitogen should fetch it from the host
node.
Ooh but if it's a module that's not in sys.modules
then the issue might be that Mitogen's import helper code couldn't find it (there's a few different ways Mitogen tries to find modules and sys.modules is one of them). I ran into a similar error with trying to get collections support to work for Mitogen: Ansible collections do a bit of a hack on the import system so that you can import X
but stuff doesn't exist in the usual places Python looks when you import something. I haven't used https://pypi.org/project/retrying/ before myself so I can't say for sure.
Would you be able to provide a sample playbook so I can reproduce the error inside of the bionic container you tried?
Let me see what I can do. It could be a few days b/c of the holiday.
No rush! 😄
Feel free to write an issue in your preferred format, however if in doubt, use the following checklist as a guide for what to include.
Which version of Ansible are you running?
Is your version of Ansible patched in any way? No
Are you running with any custom modules, or
module_utils
loaded? NoHave you tried the latest master version from Git? No, but have tried the latest release version 0.2.9.
Do you have some idea of what the underlying problem may be? https://mitogen.networkgenomics.com/ansible_detailed.html#common-problems has instructions to help figure out the likely cause and how to gather relevant logs. From looking at other open issues, I thought it was initially related to using the wrong python, but
retrying
is installed with Python 3.6 which is being used by Mitogen.Mention your host and target OS and versions Docker:
Mention your host and target Python versions Hosts are also Ubuntu, Python3.6.
If reporting any kind of problem with Ansible, please include the Ansible version along with output of "ansible-config dump --only-changed".