Merge "ara_api: use current PATH if no virtualenvs are used"

This commit is contained in:
Zuul 2020-08-01 22:39:45 +00:00 committed by Gerrit Code Review
commit 9be44da985
6 changed files with 15 additions and 4 deletions

View File

@ -49,7 +49,7 @@
block:
- name: Generate a random secret key
environment:
PATH: "{{ path_with_virtualenv | default('/usr/bin:/usr/local/bin') }}"
PATH: "{{ path_with_virtualenv }}"
command: python3 -c "from django.utils.crypto import get_random_string; print(get_random_string(length=50))"
no_log: "{{ ara_api_secure_logging }}"
register: generated_key

View File

@ -45,7 +45,7 @@
- name: Run SQL migrations
environment:
ARA_SETTINGS: "{{ ara_api_settings }}"
PATH: "{{ path_with_virtualenv | default('/usr/bin:/usr/local/bin') }}"
PATH: "{{ path_with_virtualenv }}"
command: ara-manage migrate
run_once: true
register: _ara_sql_migrations

View File

@ -45,7 +45,7 @@
- name: Run SQL migrations
environment:
ARA_SETTINGS: "{{ ara_api_settings }}"
PATH: "{{ path_with_virtualenv | default('/usr/bin:/usr/local/bin') }}"
PATH: "{{ path_with_virtualenv }}"
command: ara-manage migrate
run_once: true
register: _ara_sql_migrations

View File

@ -26,5 +26,5 @@
become: "{{ (ansible_user_dir in ara_api_database_name) | ternary(false, true) }}"
environment:
ARA_SETTINGS: "{{ ara_api_settings }}"
PATH: "{{ path_with_virtualenv | default('/usr/bin:/usr/local/bin') }}"
PATH: "{{ path_with_virtualenv }}"
command: ara-manage migrate

View File

@ -27,3 +27,8 @@
package:
name: "{{ ara_distribution_packages }}"
state: present
# This lets us use "path_with_virtualenv" without conditions everywhere
- name: Don't prefix the virtualenv bin directory to PATH
set_fact:
path_with_virtualenv: "{{ ansible_env.PATH }}"

View File

@ -33,3 +33,9 @@
set_fact:
path_with_virtualenv: "{{ ara_api_venv_path }}/bin:{{ ansible_env.PATH }}"
when: ara_api_venv | bool
# This lets us use "path_with_virtualenv" without conditions everywhere
- name: Otherwise don't prefix the virtualenv bin directory to PATH
set_fact:
path_with_virtualenv: "{{ ansible_env.PATH }}"
when: not ara_api_venv | bool