From 492d01ff3b9be0eb48bd00bc7bd204fd5c1d95a6 Mon Sep 17 00:00:00 2001 From: Gabe Muniz Date: Mon, 11 May 2020 17:10:01 -0400 Subject: [PATCH] added try/except to virtual env --- awx/main/utils/common.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/awx/main/utils/common.py b/awx/main/utils/common.py index 0eb8741d9a..2a634b132e 100644 --- a/awx/main/utils/common.py +++ b/awx/main/utils/common.py @@ -1010,14 +1010,18 @@ 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.") + pass return custom_venv_choices