Skip to content

Commit

Permalink
[fix] Fix failing redis installation on Ubuntu 20.04
Browse files Browse the repository at this point in the history
- Increased minor versions
  • Loading branch information
nemesifier committed May 30, 2022
1 parent 29922d6 commit db7f16a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 31 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
- name: Set default python version
run: sudo update-alternatives --install /usr/bin/python python ${pythonLocation}/bin/python3.8 2


- name: Install python dependencies
run: |
pip install molecule[docker,ansible] molecule-docker yamllint ansible-lint docker openwisp-utils[qa]
Expand All @@ -47,7 +46,10 @@ jobs:
openwisp-qa-check --skip-isort --skip-flake8 --skip-checkmigrations --skip-black
- name: Tests
run: molecule test
run: |
mkdir -p ~/.ansible/roles
ln -s $GITHUB_WORKSPACE ~/.ansible/roles/openwisp.openwisp2
molecule test
env:
ROLE_NAME: openwisp2
PY_COLORS: '1'
Expand Down
4 changes: 2 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ openwisp2_monitoring: true
openwisp2_radius: false
openwisp2_controller_subnet_division: false
openwisp2_radius_urls: "{{ openwisp2_radius }}"
openwisp2_controller_version: "openwisp-controller~=1.0.0"
openwisp2_controller_version: "openwisp-controller~=1.0.1"
openwisp2_network_topology_version: "openwisp-network-topology~=1.0.0"
openwisp2_firmware_upgrader_version: "openwisp-firmware-upgrader~=1.0.0"
openwisp2_monitoring_version: "openwisp-monitoring~=1.0.0"
openwisp2_radius_version: "openwisp-radius~=1.0.0"
openwisp2_radius_version: "openwisp-radius~=1.0.1"
openwisp2_django_version: "{{ 'django~=4.0.0' if ansible_distribution_release|string in ['focal', 'bullseye'] else 'django~=3.2.13' }}"
openwisp2_extra_python_packages:
- bpython
Expand Down
28 changes: 4 additions & 24 deletions tasks/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,14 @@
register: result
until: result is success

- name: Install redis 6 if available
- name: Install redis
apt:
name: "redis-server=5:6*"
name: redis-server
notify:
- reload systemd
- start redis
ignore_errors: true
register: use_redis6
when: openwisp2_redis_install

- name: Install redis 5 if available
apt:
name: "redis-server=5:5*"
notify:
- reload systemd
- start redis
ignore_errors: true
register: use_redis5
when: openwisp2_redis_install and use_redis6 is failed

- name: Install redis 4 (fallback)
when: openwisp2_redis_install and (use_redis5 is failed and use_redis6 is failed)
apt:
name: "redis-server=5:4*"
register: use_redis4
notify:
- reload systemd
- start redis

# On the newer versions of redis, by default redis
# binds to localhost on ipv6 address which wouldn't
# let the service start if the server doesn't have
Expand All @@ -77,6 +56,7 @@
regexp: '^bind 127\.0\.0\.1 ::1'
line: 'bind 127.0.0.1'
backrefs: true
ignore_errors: true

- name: start redis
when: openwisp2_redis_install
Expand Down Expand Up @@ -189,7 +169,7 @@
- name: Set python 3.7
set_fact:
openwisp2_python: python3.7
when: openwisp2_should_install_python_37 == "True\n"
when: openwisp2_should_install_python_37 == true

- name: Install python3 packages
apt:
Expand Down
22 changes: 19 additions & 3 deletions tasks/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,27 @@
tags:
- molecule-idempotence-notest

- name: Pin channels_redis to 2.4 for redis 4 compatibility
when: use_redis4 is defined and use_redis4 is succeeded
- name: Install channels-redis~=3.4.0
when: ansible_distribution_release not in ['buster', 'bionic']
pip:
name:
- channels_redis~=2.4
- channels-redis~=3.4.0
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
virtualenv_site_packages: true
environment:
SETUPTOOLS_USE_DISTUTILS: stdlib
retries: 1
delay: 10
register: result
until: result is success

- name: Install channels-redis~=2.4.0 for redis 4 compatibility
when: ansible_distribution_release in ['buster', 'bionic']
pip:
name:
- channels-redis~=2.4.0
state: latest
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
Expand Down

0 comments on commit db7f16a

Please sign in to comment.