Open opoplawski opened 4 years ago
Anything else I can provide to help debug this? Really missing being able to use mitogen for this.
Can you try latest master
with Ansible 2.8.8 and python3? I'm working on getting Ansible 2.9+ support fully working, so that might be why. Collections also don't really work either; see #652 , so that could also be why. 🤔
Thanks, but I still get the same error with that. Not using collections directly - I have the module installed directly in my library/module_utils directories.
Ahh ok. I'll try and repro at some point soon; not sure how many other collaborators are currently working on mitogen 😬 lately it's just been me afaict.
This is still a big thorn in my side. I'd be happy to try to help, but I really have no idea where to start looking.
Ah my bad, somehow this ticket slipped my mind :disappointed: if you wanna debug it yourself you could put in an epdb.set_trace()
at where it failed and it should drop you into the env. I found that epdb
works better than pdb
for me when doing Ansible stuff.
If you'd like me to debug it instead could you dump the task snippet from here?
roles/pfsense/tasks/auth.yml
I went to your repo and then tried to go to file
and there was nothing called auth.yml
Thanks, I'll try to poke around. Really any pfsense_ task should trigger it. Something simple would be:
- name: Add adservers alias
pfsense_alias:
name: adservers
address: 10.0.0.1 10.0.0.2
state: present
Well, renaming __impl to impl doesn't make a difference. Perhaps it is because we are doing imports at the class level and not top?
class PFSenseModule(object):
""" class managing pfsense base configuration """
# pylint: disable=import-outside-toplevel
from ansible.module_utils.network.pfsense.impl.interfaces import (
get_interface_display_name,
...
That seems to be it - if I duplicate the imports at the top-level then it runs fine.
Oh that makes sense. Check out the various FinderMethod
classes here (base class for reference): https://github.com/dw/mitogen/blob/master/mitogen/master.py#L421 . Seems like it would be a good idea to have another one for class-level imports added to here: https://github.com/dw/mitogen/blob/master/mitogen/master.py#L735 🤔
Actually I think the code in question is module_finder.scan() - https://github.com/dw/mitogen/blob/master/ansible_mitogen/module_finder.py#L128 which appears to only scan the top level modules for imports. I suspect it would be a fairly significant change to also scan any defined classes inside those modules.
ooh good point 👍
So, I'm no python opcode expert, but it seems like we could find the code objects for classes in scan_code_imports() and do some kind of recursive scan:
for (op1, arg1), (op2, arg2), (op3, arg3) in izip(opit, opit2, opit3):
if (detect a LOAD_CONST code object):
scan_code_imports(code object)
Please drag-drop large logs as text file attachments.
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? 2.9.2
Is your version of Ansible patched in any way? no
Are you running with any custom modules, or
module_utils
loaded? https://github.com/opoplawski/ansible-pfsenseHave you tried the latest master version from Git? Yes
Do you have some idea of what the underlying problem may be? I think mitogen is not deploying the local module_utils/network/pfsense/__impl tree
Mention your host and target OS and versions CentOS 7 -> pfSense
Mention your host and target Python versions host: python 2.7.5, target: python 2.7.16
The playbook works fine without mitogen.
Logs: