ensure-twine: Avoid Reinstalling twine if present

On a static node where twine isn't present in the PATH, twine would be
always reinstalled even if already present in venv because it's not checked.

This patch adds twine pip check, the first matching line is used to get
executable path

Change-Id: I2c972147269bf717c30f093975ca6349bed68fbe
This commit is contained in:
Guillaume Chauvel 2020-06-08 13:46:35 +02:00
parent 0b152244e4
commit f465198cb0

View File

@ -1,6 +1,6 @@
- name: Check for twine install
shell: |
command -v {{ twine_executable }} || exit 1
command -v {{ twine_executable }} ~/.local/bin/twine || exit 1
args:
executable: /bin/bash
failed_when: false
@ -8,7 +8,7 @@
- name: Set pypi_twine_executable
set_fact:
pypi_twine_executable: "{{ register_twine.stdout }}"
pypi_twine_executable: "{{ register_twine.stdout_lines[0] }}"
when: register_twine.rc == 0
- name: Ensure twine is installed