From 0b152244e49c51dc8ef2625b56bfd9f00404c111 Mon Sep 17 00:00:00 2001 From: Guillaume Chauvel Date: Mon, 8 Jun 2020 13:27:59 +0200 Subject: [PATCH] ensure-tox: Avoid Reinstalling tox venv if present On a static node where tox isn't present in the PATH, tox would be always reinstalled even if already present in venv because it's not checked. This patch adds tox_venv check, the first matching line is used to get executable path Change-Id: Ia27af308cd3b5e2ce5efe36508fe82468e88cbc7 --- roles/ensure-tox/tasks/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/ensure-tox/tasks/main.yaml b/roles/ensure-tox/tasks/main.yaml index dff39a0f1..0073ca90f 100644 --- a/roles/ensure-tox/tasks/main.yaml +++ b/roles/ensure-tox/tasks/main.yaml @@ -6,7 +6,7 @@ - name: Check if tox is installed shell: | - command -v {{ tox_executable }} || exit 1 + command -v {{ tox_executable }} {{ tox_venv_path }}/bin/tox || exit 1 args: executable: /bin/bash register: tox_preinstalled @@ -14,7 +14,7 @@ - name: Export preinstalled tox_exectuable set_fact: - tox_executable: '{{ tox_preinstalled.stdout }}' + tox_executable: '{{ tox_preinstalled.stdout_lines[0] }}' cacheable: true when: tox_preinstalled.rc == 0