mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
doc: exercising module code locally: update cmd (#45697)
The documented way to execute module code locally wasn't always working:
$ python ./lib/ansible/modules/files/file.py <<< '{"ANSIBLE_MODULE_ARGS": {}}'
Traceback (most recent call last):
File "./lib/ansible/modules/files/file.py", line 177, in <module>
from ansible.module_utils.basic import AnsibleModule
File "~/ansible/lib/ansible/module_utils/basic.py", line 78, in <module>
import tempfile
File "~/ansible/lib/ansible/modules/files/tempfile.py", line 69, in <module>
from tempfile import mkstemp, mkdtemp
ImportError: cannot import name 'mkstemp'
This commit is contained in:
@@ -211,7 +211,7 @@ If you module does not need to target a remote host, you can quickly and easily
|
||||
development) activate it: ``$ . venv/bin/activate``
|
||||
- Setup the environment for development: ``$ . hacking/env-setup``
|
||||
- Run your test module locally and directly:
|
||||
``$ python ./my_new_test_module.py /tmp/args.json``
|
||||
``$ python -m ansible.modules.cloud.azure.my_new_test_module /tmp/args.json``
|
||||
|
||||
This should return output something like this:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user