summaryrefslogtreecommitdiff
path: root/lib/ansible/executor/module_common.py
diff options
context:
space:
mode:
authorRick Elrod <rick@elrod.me>2020-06-01 03:43:20 -0500
committerGitHub <noreply@github.com>2020-06-01 03:43:20 -0500
commit2abaf320d746c8680a0ce595ad0de93639c7e539 (patch)
treed3dbbeaa7b76cec5454041a5575d685c182585c0 /lib/ansible/executor/module_common.py
parent79ab7984272120a5444bee9a0a1ea6e799789696 (diff)
downloadansible-2abaf320d746c8680a0ce595ad0de93639c7e539.tar.gz
[ansiballz] ensure that '' is not in sys.path (#69342)
Change: On OpenBSD when using pipelining, we do not set cwd which results in a permissions fatal. Ensure that `''` - cwd - is not in `sys.path`. Test Plan: Tested against local OpenBSD VM Tickets: Fixes #69320 Signed-off-by: Rick Elrod <rick@elrod.me>
Diffstat (limited to 'lib/ansible/executor/module_common.py')
-rw-r--r--lib/ansible/executor/module_common.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ansible/executor/module_common.py b/lib/ansible/executor/module_common.py
index fea097cf90..05b1e8ab2f 100644
--- a/lib/ansible/executor/module_common.py
+++ b/lib/ansible/executor/module_common.py
@@ -143,8 +143,10 @@ def _ansiballz_main():
# OSX raises OSError if using abspath() in a directory we don't have
# permission to read (realpath calls abspath)
pass
- if scriptdir is not None:
- sys.path = [p for p in sys.path if p != scriptdir]
+
+ # Strip cwd from sys.path to avoid potential permissions issues
+ excludes = set(('', '.', scriptdir))
+ sys.path = [p for p in sys.path if p not in excludes]
import base64
import runpy