ensure-pip : fix Xenial exported virtualenv command
This is a fix for Id8347b6b09735659a7ed9bbe7f9d2798fbec9620 which did not specify the full path in ensure_pip_virtualenv_command for Xenial. This slipped by testing because there we check ensure_pip_virtualenv_command runs under a shell:, but not when called as the argument to the pip: module (which exec's it differently and requires the full path). Update testing to do that too. Change-Id: I65ff5ce913917079ab2fc1d88c56d1c0a24ea83e
This commit is contained in:
parent
47bce7db05
commit
f578a38693
@ -84,5 +84,5 @@
|
||||
|
||||
- name: Override virtualenv
|
||||
set_fact:
|
||||
ensure_pip_virtualenv_command: 'virtualenv -p python3'
|
||||
ensure_pip_virtualenv_command: '/usr/local/bin/virtualenv -p python3'
|
||||
when: _pip_check.rc == 0
|
||||
|
@ -1,24 +1,32 @@
|
||||
- hosts: all
|
||||
tasks:
|
||||
# ensure-pip
|
||||
|
||||
- name: Include ensure-pip
|
||||
include_role:
|
||||
name: ensure-pip
|
||||
|
||||
- name: Sanity check provided virtualenv command works
|
||||
shell: |
|
||||
tmp_venv=$(mktemp -d -t venv-XXXXXXXXXX)
|
||||
trap "rm -rf $tmp_venv" EXIT
|
||||
{{ ensure_pip_virtualenv_command }} $tmp_venv
|
||||
$tmp_venv/bin/pip install tox
|
||||
failed_when: false
|
||||
register: _venv_sanity
|
||||
- name: Create temp directory
|
||||
tempfile:
|
||||
state: directory
|
||||
suffix: venv-test
|
||||
register: _tmp_venv
|
||||
|
||||
- name: Assert pip venv sanity check
|
||||
fail:
|
||||
msg: 'The virtualenv_command: "{{ ensure_pip_virtualenv_command }}" does not appear to work!'
|
||||
when:
|
||||
- _venv_sanity.rc != 0
|
||||
- name: Sanity check provided virtualenv command installs
|
||||
pip:
|
||||
name: tox
|
||||
virtualenv_command: '{{ ensure_pip_virtualenv_command }}'
|
||||
virtualenv: '{{ _tmp_venv.path }}'
|
||||
|
||||
- name: Sanity check installed command runs without error
|
||||
command: '{{ _tmp_venv.path }}/bin/tox --version'
|
||||
|
||||
- name: Remove tmpdir
|
||||
file:
|
||||
path: '{{ _tmp_venv.path }}'
|
||||
state: absent
|
||||
|
||||
# ensure-virtualenv
|
||||
- name: Include ensure-virtualenv
|
||||
include_role:
|
||||
name: ensure-virtualenv
|
||||
|
Loading…
Reference in New Issue
Block a user