Skip to content

Commit

Permalink
[fix] Fixed Python <3.7
Browse files Browse the repository at this point in the history
Running
$ ansible-playbook -i hosts playbook.yml -u user --check
would always result in an error because the variable
{{openwisp2_installed_python}} would never have been set when running
with --check.

It is Ansible best practice to use Ansible native checks wherever possible
and it is reasonable to assume that Ansible runs in the Python version the
system has. For Python version checking, see https://serverfault.com/a/858684

Another change is to install >= Python 3.7 only if < Python 3.7 is found.
The old expression would install deadsnakes-python3.7 over system python3.7
  • Loading branch information
emsu-io-suefke authored Oct 18, 2022
1 parent e301eb2 commit b50ef79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tasks/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
- name: Check openwisp2 should install python 3.7
set_fact:
openwisp2_should_install_python_37: |
{{ openwisp2_installed_python.stdout.split(' ')[1] is version_compare('3.7', 'le') }}
{{ ansible_python_version is version_compare('3.7', 'lt') }}
- name: Install Python 3.7 and required packages from ppa:deadsnakes/ppa
block:
Expand Down

0 comments on commit b50ef79

Please sign in to comment.