From 052f28a9a2077a6e2941268ba8ceb01d0914578c Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Tue, 21 May 2019 11:02:35 -0400 Subject: [PATCH] roles: use virtualenv_command instead of virtualenv_python python3 -m venv is always expected to work while virtualenv_python might attempt to use a virtualenv binary script. We already make sure that python3-venv is installed in the ara_api pre-requirements. Fixes: https://github.com/ansible-community/ara/issues/43 Change-Id: I0994cd99e24f9a23d0dfeb66e8b838ced7aed948 --- .zuul.d/zuul.yaml | 1 + .../django.db.backends.postgresql.yaml | 2 +- roles/ara_api/tasks/install/source.yaml | 2 +- roles/ara_api/tasks/wsgi_server/gunicorn.yaml | 2 +- roles/ara_tests/tasks/main.yaml | 11 +++++++++-- tests/test_tasks.yaml | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.zuul.d/zuul.yaml b/.zuul.d/zuul.yaml index 750dea89..8c55feb4 100644 --- a/.zuul.d/zuul.yaml +++ b/.zuul.d/zuul.yaml @@ -19,6 +19,7 @@ ara_tests_cleanup: false integration_ansible_name: "{{ ansible_user_dir }}/src/github.com/ansible/ansible" integration_ansible_version: null + pre-run: tests/role-integration-pre.yaml run: playbooks/ara_tests.yaml post-run: tests/ara_tests_post.yaml diff --git a/roles/ara_api/tasks/database_engine/django.db.backends.postgresql.yaml b/roles/ara_api/tasks/database_engine/django.db.backends.postgresql.yaml index c5298d05..0b9f19ff 100644 --- a/roles/ara_api/tasks/database_engine/django.db.backends.postgresql.yaml +++ b/roles/ara_api/tasks/database_engine/django.db.backends.postgresql.yaml @@ -40,7 +40,7 @@ name: psycopg2 state: present virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}" - virtualenv_python: python3 + virtualenv_command: /usr/bin/python3 -m venv - name: Run SQL migrations environment: diff --git a/roles/ara_api/tasks/install/source.yaml b/roles/ara_api/tasks/install/source.yaml index acd2c677..dfca3af1 100644 --- a/roles/ara_api/tasks/install/source.yaml +++ b/roles/ara_api/tasks/install/source.yaml @@ -27,7 +27,7 @@ name: "{{ ara_api_source_checkout }}[server]" state: present virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}" - virtualenv_python: python3 + virtualenv_command: /usr/bin/python3 -m venv - name: Prefix the virtualenv bin directory to PATH set_fact: diff --git a/roles/ara_api/tasks/wsgi_server/gunicorn.yaml b/roles/ara_api/tasks/wsgi_server/gunicorn.yaml index 0c0b11ea..696eca46 100644 --- a/roles/ara_api/tasks/wsgi_server/gunicorn.yaml +++ b/roles/ara_api/tasks/wsgi_server/gunicorn.yaml @@ -21,7 +21,7 @@ name: gunicorn state: present virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}" - virtualenv_python: python3 + virtualenv_command: /usr/bin/python3 -m venv - become: yes block: diff --git a/roles/ara_tests/tasks/main.yaml b/roles/ara_tests/tasks/main.yaml index 283492a9..3b1d3214 100644 --- a/roles/ara_tests/tasks/main.yaml +++ b/roles/ara_tests/tasks/main.yaml @@ -31,6 +31,13 @@ _ara_tests_repository: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}" when: zuul is not defined +- name: Ensure python3-venv is installed for Ubuntu + become: yes + package: + name: python3-venv + state: present + when: ansible_distribution == "Ubuntu" + # If a version is not explicitly set we want to make sure to # completely omit the version argument to pip, as it will be coming # from the long-form integration_ansible_name variable. Additionally, if @@ -52,14 +59,14 @@ version: "{{ _install_ansible_version | default(omit, True) }}" state: "{{ _install_ansible_state | default(omit, True) }}" virtualenv: "{{ ara_tests_virtualenv }}" - virtualenv_python: python3 + virtualenv_command: /usr/bin/python3 -m venv - name: Install ARA from source in virtual environment pip: name: "{{ _ara_tests_repository }}[server]" state: present virtualenv: "{{ ara_tests_virtualenv }}" - virtualenv_python: python3 + virtualenv_command: /usr/bin/python3 -m venv - name: Get ARA plugins directory command: "{{ ara_tests_virtualenv }}/bin/python -m ara.setup.plugins" diff --git a/tests/test_tasks.yaml b/tests/test_tasks.yaml index f0b9bbf7..3a460945 100644 --- a/tests/test_tasks.yaml +++ b/tests/test_tasks.yaml @@ -45,7 +45,7 @@ version: "{{ _install_ansible_version | default(omit, True) }}" state: "{{ _install_ansible_state | default(omit, True) }}" virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}" - virtualenv_python: python3 + virtualenv_command: /usr/bin/python3 -m venv - name: Get ARA plugins directory environment: