1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 22:21:13 +03:00

Merge pull request #4361 from ryanpetrello/venv-try-except

[3.7.1] backport a change to address venv permission issues
This commit is contained in:
Ryan Petrello 2020-05-26 11:31:16 -04:00 committed by GitHub
commit bd23c41d25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1010,14 +1010,17 @@ def get_custom_venv_choices(custom_paths=None):
custom_venv_choices = []
for custom_venv_path in all_venv_paths:
if os.path.exists(custom_venv_path):
custom_venv_choices.extend([
os.path.join(custom_venv_path, x, '')
for x in os.listdir(custom_venv_path)
if x != 'awx' and
os.path.isdir(os.path.join(custom_venv_path, x)) and
os.path.exists(os.path.join(custom_venv_path, x, 'bin', 'activate'))
])
try:
if os.path.exists(custom_venv_path):
custom_venv_choices.extend([
os.path.join(custom_venv_path, x, '')
for x in os.listdir(custom_venv_path)
if x != 'awx' and
os.path.isdir(os.path.join(custom_venv_path, x)) and
os.path.exists(os.path.join(custom_venv_path, x, 'bin', 'activate'))
])
except Exception:
logger.exception("Encountered an error while discovering custom virtual environments.")
return custom_venv_choices