zuul-jobs/test-playbooks/ensure-tox.yaml
Ian Wienand 7a66a26b77
ansible-lint: fix a bunch of command-instead-of-shell errors
These all trigger command-instead-of-shell for ansible-lint 6.12.0.
It seems a few were ignored with warnings with
I4e415cbd34f0f4cb15857051bf95458e0316de86.

I don't see why these can't be command: for consistency

Change-Id: Ib0f590b461d2a5a7d9bb8bdddcbbfb2230cc3d1c
2023-02-03 15:06:03 +11:00

52 lines
1.7 KiB
YAML

- hosts: all
name: Remove any pre-installed tox
tasks:
- name: Remove tox package with pip
command: pip uninstall -y tox
become: true
failed_when: false
- name: Remove tox package with pip3
command: pip3 uninstall -y tox
become: true
failed_when: false
- name: Verify tox is not installed
command: "tox --version"
register: result
failed_when: result.rc == 0
- hosts: all
name: Test ensure-tox installs into user environment
tasks:
- name: Verify tox is not installed
command: "tox --version"
register: result
failed_when: result.rc == 0
- name: Run ensure-tox with tox not installed
include_role:
name: ensure-tox
- name: Verify tox_executable is set
assert:
that:
- tox_executable == "{{ ansible_user_dir }}/.local/tox/bin/tox"
- name: Verify tox is installed
command: "{{ tox_executable }} --version"
register: result
failed_when: result.rc != 0
- hosts: all
name: Test ensure-tox when tox_executable is set to an already installed tox
tasks:
- name: Create a virtualenv
command: '{{ ensure_pip_virtualenv_command }} {{ ansible_user_dir }}/tox-venv'
- name: Install tox to local venv
command: '{{ ansible_user_dir }}/tox-venv/bin/pip install tox'
- name: Run ensure-tox pointing to an already installed tox
include_role:
name: ensure-tox
vars:
tox_executable: "{{ ansible_user_dir }}/tox-venv/bin/tox"
- name: Verify tox_executable is set to the virtualenv tox
assert:
that:
- tox_executable == '{{ ansible_user_dir }}/tox-venv/bin/tox'