Clarify error message when module replacer encounters a bad import line for module_utils code

This commit is contained in:
Toshio Kuratomi 2016-02-10 08:45:29 -08:00
parent d9dcb2a427
commit 486304ba1c

View file

@ -97,7 +97,7 @@ def _find_snippet_imports(module_data, module_path, strip_comments):
if " import *" not in line: if " import *" not in line:
import_error = True import_error = True
if import_error: if import_error:
raise AnsibleError("error importing module in %s, expecting format like 'from ansible.module_utils.basic import *'" % module_path) raise AnsibleError("error importing module in %s, expecting format like 'from ansible.module_utils.<lib name> import *'" % module_path)
snippet_name = tokens[2].split()[0] snippet_name = tokens[2].split()[0]
snippet_names.append(snippet_name) snippet_names.append(snippet_name)
output.write(_slurp(os.path.join(_SNIPPET_PATH, snippet_name + ".py"))) output.write(_slurp(os.path.join(_SNIPPET_PATH, snippet_name + ".py")))