Last active
April 29, 2016 20:16
-
-
Save jctanner/2844a4ea64d1216c599e0eecac2e5d86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py | |
index 7ae2cb9..312712f 100644 | |
--- a/lib/ansible/module_utils/basic.py | |
+++ b/lib/ansible/module_utils/basic.py | |
@@ -1975,6 +1975,16 @@ class AnsibleModule(object): | |
old_env_vals['PATH'] = os.environ['PATH'] | |
os.environ['PATH'] = "%s:%s" % (path_prefix, os.environ['PATH']) | |
+ # Clean out python paths set by ziploader | |
+ if 'PYTHONPATH' in os.environ: | |
+ ppaths = os.environ['PYTHONPATH'].split(':') | |
+ ppaths = [x for x in ppaths \ | |
+ if not x.endswith('/ansible_modlib.zip')] | |
+ ppaths = [x for x in ppaths \ | |
+ if not x.endswith('/debug_dir')] | |
+ os.environ['PYTHONPATH'] = ':'.join(ppaths) | |
+ | |
+ | |
# create a printable version of the command for use | |
# in reporting later, which strips out things like | |
# passwords from the args list | |
@@ -2016,7 +2026,6 @@ class AnsibleModule(object): | |
stdin=st_in, | |
stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE, | |
- env=os.environ, | |
) | |
if cwd and os.path.isdir(cwd): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment