From db7f16a66b9862255ba70a9a9d46a6fe144dc487 Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Sat, 28 May 2022 11:16:38 -0400 Subject: [PATCH] [fix] Fix failing redis installation on Ubuntu 20.04 - Increased minor versions --- .github/workflows/ci.yml | 6 ++++-- defaults/main.yml | 4 ++-- tasks/apt.yml | 28 ++++------------------------ tasks/pip.yml | 22 +++++++++++++++++++--- 4 files changed, 29 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15f4b997..0f26ed4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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] @@ -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' diff --git a/defaults/main.yml b/defaults/main.yml index d40b26d8..873ad08d 100755 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/tasks/apt.yml b/tasks/apt.yml index 71bfe1f4..76fa0f57 100644 --- a/tasks/apt.yml +++ b/tasks/apt.yml @@ -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 @@ -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 @@ -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: diff --git a/tasks/pip.yml b/tasks/pip.yml index 72f1eafd..d6bcaa32 100644 --- a/tasks/pip.yml +++ b/tasks/pip.yml @@ -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 }}"