From 2abaf320d746c8680a0ce595ad0de93639c7e539 Mon Sep 17 00:00:00 2001 From: Rick Elrod Date: Mon, 1 Jun 2020 03:43:20 -0500 Subject: [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 --- lib/ansible/executor/module_common.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3