From c46ef98496f7286bb15e3c5d6e1d14e6a1ac94ca Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 19 Dec 2016 11:11:55 -0800 Subject: [PATCH] Replace the old ansible.module_utils best practices with the new ones. --- docsite/rst/dev_guide/developing_modules.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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::