Skip to content

Commit

Permalink
Make sure we don't end up with an empty PYTHONPATH (ansible#16240)
Browse files Browse the repository at this point in the history
When the PYTHONPATH is an empty string python will treat it as though
the cwd is in the PYTHONPATH.  This can be undesirable.  So make sure we
delete PYTHONPATH from the environment altgether in this case.

Fixes ansible#16195
  • Loading branch information
abadger authored Jun 15, 2016
1 parent 27d0fe8 commit c483828
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ansible/module_utils/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,8 @@ def run_command(self, args, check_rc=False, close_fds=True, executable=None, dat
if not x.endswith('/ansible_modlib.zip') \
and not x.endswith('/debug_dir')]
os.environ['PYTHONPATH'] = ':'.join(pypaths)
if not os.environ['PYTHONPATH']:
del os.environ['PYTHONPATH']

# create a printable version of the command for use
# in reporting later, which strips out things like
Expand Down

0 comments on commit c483828

Please sign in to comment.