-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Ziploader "recursive imports" and caching #15344
Conversation
New commits make these changes, also needed for 2.1:
This does not work: In python-2.7+ they apparently fixed the problems with this so that using -m with a package works. Anyhow... the fact that python-2.4's -m is just a fancy method of locating a script, since we control where the script gets placed, and since python-2.6 is the first point where we have a -m that we can make do what we want, I decided to just invoke a script for now. When we can say that py2.6 is the lowest version of python we support on the managed node side we can re-add -m support. |
…ne may be too slow.
This makes our recursive, ast.parse performance measures as fast as pre-ziploader baseline. Since this unittest isn't testing that the returned module data is correct we don't need to worry about os.rename not having any module data. Should devise a separate test for the module and caching code
…er to the module)
Extract the module and invoke it as a script to work around python-2.4's lack of features.
Latest version has passed travis in my repo: https://travis-ci.org/abadger/ansible/builds/122534682 Ready for review. |
At today's meeting, decided to merge and use devel to test that everything works. |
ISSUE TYPE
SUMMARY
The first version of ziploader is able to find module_utils files that are listed in the module itself and make sure that those files are included in the zipfile that is sent to the remote machine. This is suboptimal as the equivalent python import will also find the module_utils files that the module_utils files have a need for. This set of commits adds that capability to ziploader and implements a simple controller-side cache to offset the increase in time that searching for the module_utils causes. The cache cleans itself up and auto-invalidates when the main ansible/ansible-playbook process ends.
Caveats to the recusive feature:
from . import urls
). Imports must be absolute imports coming from ansible.module_utils.__init__.py
in them). module_utils will only be searched for *.py files right now, not directories. (example:from ansible.module_utils.basic import AnsibleModule
will look foransible/module_utils/basic.py
. It will not look foransible/module_utils/basic/__init__.py
even though python itself would.)There's also a couple unrelated bug fixes (Fixing encoding string in the wrapper which was being lost when we implemented comment stripping of the wrapper and a correction to the process.worker.run documentation since worker no longer loops).