diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2016-12-19 11:11:55 -0800 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-12-19 11:11:55 -0800 |
commit | c46ef98496f7286bb15e3c5d6e1d14e6a1ac94ca (patch) | |
tree | 847a4cdf015e70fd6702e8e4b207973f30d23272 | |
parent | cfa8ce767baaf02215bf5c0f6d4a502b02516018 (diff) | |
download | ansible-c46ef98496f7286bb15e3c5d6e1d14e6a1ac94ca.tar.gz |
Replace the old ansible.module_utils best practices with the new ones.
-rw-r--r-- | docsite/rst/dev_guide/developing_modules.rst | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/docsite/rst/dev_guide/developing_modules.rst b/docsite/rst/dev_guide/developing_modules.rst index 0522514f92..83c92bacaa 100644 --- a/docsite/rst/dev_guide/developing_modules.rst +++ b/docsite/rst/dev_guide/developing_modules.rst @@ -698,7 +698,8 @@ The following checklist items are important guidelines for people who want to c * The return structure should be consistent, even if NA/None are used for keys normally returned under other options. * Are module actions idempotent? If not document in the descriptions or the notes. -* Import module snippets `from ansible.module_utils.basic import *` at the bottom, conserves line numbers for debugging. +* Import ``ansible.module_utils`` code in the same place as you import other libraries. In older code, this was done at the bottom of the file but that's no longer needed. +* Do not use wildcards for importing other python modules (ex: ``from ansible.module_utils.basic import *``). This used to be required for code imported from ``ansible.module_utils`` but, from Ansible-2.1 onwards, it's just an outdated and bad practice. * The module must have a `main` function that wraps the normal execution. * Call your :func:`main` from a conditional so that it would be possible to import them into unittests in the future example:: |