Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the version of Python used by ARA configurable #70

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion roles/ara_api/tasks/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- name: Generate a random secret key
environment:
PATH: "{{ path_with_virtualenv }}"
command: python3 -c "from django.utils.crypto import get_random_string; print(get_random_string(length=50))"
command: "{{ ara_api_python_command }} -c 'from django.utils.crypto import get_random_string; print(get_random_string(length=50))'"
no_log: "{{ ara_api_secure_logging }}"
register: generated_key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
name: mysqlclient
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"

- name: Run SQL migrations
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
name: psycopg2<2.9
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"

- name: Run SQL migrations
environment:
Expand Down
4 changes: 2 additions & 2 deletions roles/ara_api/tasks/install/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
state: "{{ (ara_api_version == 'latest') | ternary('latest', 'present') }}"
version: "{{ (ara_api_version != 'latest') | ternary(ara_api_version, omit) }}"
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"
notify: restart ara-api

- name: Install python-passlib for managing authentication credentials
pip:
name: passlib
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"
when: ara_api_external_auth

- name: Prefix the virtualenv bin directory to PATH
Expand Down
4 changes: 2 additions & 2 deletions roles/ara_api/tasks/install/source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
name: "{{ ara_api_source_checkout }}[server]"
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"

- name: Install python-passlib for managing authentication credentials
pip:
name: passlib
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"
when: ara_api_external_auth

- name: Prefix the virtualenv bin directory to PATH
Expand Down
2 changes: 1 addition & 1 deletion roles/ara_api/tasks/pre-requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# The ansible_python_version fact might end up retrieving the version of
# python2 so we need to explicitely get the version of python 3 available.
- name: Validate availability of Python 3.5
command: /usr/bin/python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'
command: "{{ ara_api_python_command }} -c 'import sys; print(\".\".join(map(str, sys.version_info[:2])))'"
changed_when: false
failed_when: false
register: python_version
Expand Down
2 changes: 1 addition & 1 deletion roles/ara_api/tasks/wsgi_server/gunicorn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
name: gunicorn
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"

- name: Get path to gunicorn
command: which gunicorn
Expand Down
4 changes: 3 additions & 1 deletion roles/ara_api/vars/CentOS_8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ara_distribution_packages: []
# but we want to use the non-system one. Install it if it's missing.
ara_api_required_packages:
- git
- python36
- python39
- policycoreutils-python-utils
# cronie provides crontab
- cronie
Expand All @@ -41,3 +41,5 @@ ara_api_mysql_packages:
- redhat-rpm-config
- python36-devel
- gcc

ara_api_python_command: /usr/bin/python3.9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should fix our issue with the jobs based on CentOS Stream 8 👍 #71

2 changes: 2 additions & 0 deletions roles/ara_api/vars/CentOS_9.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ ara_api_mysql_packages:
- redhat-rpm-config
- python3-devel
- gcc

ara_api_python_command: /usr/bin/python3
2 changes: 2 additions & 0 deletions roles/ara_api/vars/Fedora.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ ara_api_mysql_packages:
- redhat-rpm-config
- python3-devel
- gcc

ara_api_python_command: /usr/bin/python3
2 changes: 2 additions & 0 deletions roles/ara_api/vars/Ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ ara_api_mysql_packages:
- libmariadbclient-dev
- python3-dev
- gcc

ara_api_python_command: /usr/bin/python3