That fails if I try what you suggest as the project (I suppose) is no
installed as a collection but git cloned
(.venv) ~/code/ansible/ansible_collections $
PYTHONPATH=/Users/cmoullia/code/ansible/ansible_collections python3
community/kubernetes/plugins/modules/k8s_log.py
Traceback (most recent call last):
File "community/kubernetes/plugins/modules/k8s_log.py", line 131, in
<module>
from
ansible_collections.community.kubernetes.plugins.module_utils.common import
KubernetesAnsibleModule
ModuleNotFoundError: No module named 'ansible_collections'
On Wed, Jul 22, 2020 at 2:48 PM Abhijeet Kasurde <[email protected]>
wrote:
> Try adding PYTHONPATH
>
> For me it is like
> PYTHONPATH=/Volumes/data/src/ansible/lib:/Volumes/data/src/ansible:/Volumes/data/src/collections
> /Volumes/data/venv3/bin/python <rest of command>
>
> On Wed, Jul 22, 2020 at 6:10 PM [email protected] <[email protected]>
> wrote:
>
>> Hi,
>>
>> As the packages to be imported by a python file are prefixed as
>> "ansible_collections.", how can we then locally debug an Ansible Module
>>
>> Example:
>> https://github.com/ansible-collections/community.kubernetes/blob/main/plugins/modules/k8s_log.py
>>
>> from ansible_collections.community.kubernetes.plugins.module_utils.common
>> import KubernetesAnsibleModule
>> ...
>>
>> class KubernetesLogModule(KubernetesAnsibleModule):
>>
>> def __init__(self, *args, **kwargs):
>> KubernetesAnsibleModule.__init__(self, *args,
>> supports_check_mode=True,
>> **kwargs)
>>
>> Result
>>
>> /usr/local/bin/python3.7 "/Users/cmoullia/Library/Application
>> Support/JetBrains/IntelliJIdea2020.1/plugins/python/helpers/pydev/pydevd.py"
>> --multiproc --qt-support=auto --client 127.0.0.1 --port 57135 --file
>> /Users/cmoullia/code/ansible/community.kubernetes/plugins/modules/k8s_log.py
>> pydev debugger: process 68087 is connecting
>>
>> Connected to pydev debugger (build 201.8538.31)
>> Traceback (most recent call last):
>> File "<frozen importlib._bootstrap>", line 983, in _find_and_load
>> File "<frozen importlib._bootstrap>", line 953, in
>> _find_and_load_unlocked
>> File "<frozen importlib._bootstrap>", line 219, in
>> _call_with_frames_removed
>> ModuleNotFoundError: No module named 'ansible_collections'
>>
>> Best
>>
>> Charles
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/386a706d-859f-429b-b100-d3d88ce1d3e8n%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/386a706d-859f-429b-b100-d3d88ce1d3e8n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Thanks,
> Abhijeet Kasurde
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/SlDn22N-1zM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFwWkHoGSb4T93_UefwDXBKunB_LUzs4TyTjf8pwhLE1H7cjZA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAFwWkHoGSb4T93_UefwDXBKunB_LUzs4TyTjf8pwhLE1H7cjZA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAPb1sSs6x0QN_ivMWyMaPCy1VJx_xEeFML%3Duqm50cz6UqFjBTQ%40mail.gmail.com.