Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't check that we import basic.py in new-style modules #16613

Merged
merged 1 commit into from
Jul 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 0 additions & 14 deletions lib/ansible/executor/module_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,6 @@ def _find_snippet_imports(module_name, module_data, module_path, module_args, ta
if os.path.exists(cached_module_filename):
display.debug('ZIPLOADER: using cached module: %s' % cached_module_filename)
zipdata = open(cached_module_filename, 'rb').read()
# Fool the check later... I think we should just remove the check
py_module_names.add(('basic',))
else:
if module_name in strategy.action_write_locks:
display.debug('ZIPLOADER: Using lock for %s' % module_name)
Expand Down Expand Up @@ -635,8 +633,6 @@ def _find_snippet_imports(module_name, module_data, module_path, module_args, ta
zipdata = open(cached_module_filename, 'rb').read()
except IOError:
raise AnsibleError('A different worker process failed to create module file. Look at traceback for that process for debugging information.')
# Fool the check later... I think we should just remove the check
py_module_names.add(('basic',))
zipdata = to_unicode(zipdata, errors='strict')

shebang, interpreter = _get_shebang(u'/usr/bin/python', task_vars)
Expand All @@ -663,13 +659,6 @@ def _find_snippet_imports(module_name, module_data, module_path, module_args, ta
)))
module_data = output.getvalue()

# Sanity check from 1.x days. Maybe too strict. Some custom python
# modules that use ziploader may implement their own helpers and not
# need basic.py. All the constants that we substituted into basic.py
# for module_replacer are now available in other, better ways.
if ('basic',) not in py_module_names:
raise AnsibleError("missing required import in %s: Did not import ansible.module_utils.basic for boilerplate helper code" % module_path)

elif module_substyle == 'powershell':
# Module replacer for jsonargs and windows
lines = module_data.split(b'\n')
Expand Down Expand Up @@ -732,9 +721,6 @@ def modify_module(module_name, module_path, module_args, task_vars=dict(), modul
... will result in the insertion of basic.py into the module
from the module_utils/ directory in the source tree.

All modules are required to import at least basic, though there will also
be other snippets.

For powershell, there's equivalent conventions like this:

# POWERSHELL_COMMON
Expand Down