summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRick Elrod <rick@elrod.me>2020-06-01 10:43:20 +0200
committerGitHub <noreply@github.com>2020-06-01 10:43:20 +0200
commit2abaf320d746c8680a0ce595ad0de93639c7e539 (patch)
treed3dbbeaa7b76cec5454041a5575d685c182585c0 /lib
parentEnable logging using setup_loggers() API in dnf-4.2.17-6 or later (diff)
downloadansible-2abaf320d746c8680a0ce595ad0de93639c7e539.tar.xz
ansible-2abaf320d746c8680a0ce595ad0de93639c7e539.zip
[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')
-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