From 4c9a13df889a081e187f358ae55c34a89898efdb Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Wed, 23 Aug 2017 17:55:18 -0400 Subject: [PATCH] Refactor ensure-twine This didn't work as expected on executor. So, now pip install depending on the rc status of which. Change-Id: Icd9da523d220973c66bc7cb4fbbd9999ec6c0dd0 Signed-off-by: Paul Belanger --- roles/ensure-twine/tasks/main.yaml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/roles/ensure-twine/tasks/main.yaml b/roles/ensure-twine/tasks/main.yaml index d5fed495b..24d19807f 100644 --- a/roles/ensure-twine/tasks/main.yaml +++ b/roles/ensure-twine/tasks/main.yaml @@ -1,18 +1,16 @@ - name: Check for twine install command: which twine - ignore_errors: yes + failed_when: false register: register_twine - name: Set pypi_twine_executable set_fact: pypi_twine_executable: "{{ register_twine.stdout }}" - when: register_twine|succeeded + when: register_twine.rc == 0 - name: Ensure twine is installed - command: pip install twine --user - when: pypi_twine_executable is not defined - -- name: Set pypi twine executable - set_fact: - pypi_twine_executable: ~/.local/bin/twine - when: pypi_twine_executable is not defined + block: + - command: pip install twine --user + - set_fact: + pypi_twine_executable: ~/.local/bin/twine + when: register_twine.rc != 0