summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Davis <nitzmahone@users.noreply.github.com>2021-04-26 08:22:27 -0700
committerGitHub <noreply@github.com>2021-04-26 10:22:27 -0500
commit768f3d75f92ea9fbef0f5ec29ceaf1811997fd8e (patch)
tree6219a1349ab2b72900449e6f49d7747cbb84aeab
parentcb4209489f6032a15a76d03feebc6556845f157e (diff)
downloadansible-768f3d75f92ea9fbef0f5ec29ceaf1811997fd8e.tar.gz
Map Debian 8 to Python 2 (#74152) (#74360)
If Python 3 is installed on Debian 8 Ansible cannot run, as the version is too old (3.4) * Add integration test for python interpreter discovery on Debian 8 * fix test issue on Debian 9, add changelog * un"fix" not broken test :D Co-authored-by: Fabian Klemp <fabian.klemp@elara-gmbh.de> Co-authored-by: Matt Davis <mrd@redhat.com> (cherry picked from commit 437a08eb6de7bf87a8c874e756f9b6b523911e68) Co-authored-by: elara-leitstellentechnik <elara-leitstellentechnik@users.noreply.github.com>
-rw-r--r--changelogs/fragments/debian8_discovery.yml2
-rw-r--r--lib/ansible/config/base.yml1
-rw-r--r--test/integration/targets/interpreter_discovery_python/tasks/main.yml7
3 files changed, 8 insertions, 2 deletions
diff --git a/changelogs/fragments/debian8_discovery.yml b/changelogs/fragments/debian8_discovery.yml
new file mode 100644
index 0000000000..d502b24fe3
--- /dev/null
+++ b/changelogs/fragments/debian8_discovery.yml
@@ -0,0 +1,2 @@
+bugfixes:
+- interpreter discovery - Debian 8 and lower will avoid unsupported Python3 version in interpreter discovery
diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml
index f2a229c926..0a3d7b1e59 100644
--- a/lib/ansible/config/base.yml
+++ b/lib/ansible/config/base.yml
@@ -1514,6 +1514,7 @@ INTERPRETER_PYTHON_DISTRO_MAP:
'6': /usr/bin/python
'8': /usr/libexec/platform-python
debian:
+ '8': /usr/bin/python
'10': /usr/bin/python3
fedora:
'23': /usr/bin/python3
diff --git a/test/integration/targets/interpreter_discovery_python/tasks/main.yml b/test/integration/targets/interpreter_discovery_python/tasks/main.yml
index be15186fb2..b8bafd1511 100644
--- a/test/integration/targets/interpreter_discovery_python/tasks/main.yml
+++ b/test/integration/targets/interpreter_discovery_python/tasks/main.yml
@@ -140,8 +140,11 @@
- name: debian assertions
assert:
that:
- - auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python3'
- when: distro == 'debian' and distro_version is version('10', '>=')
+ # Debian 8 and older
+ - auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python' and distro_version is version('8', '<=') or distro_version is version('8', '>')
+ # Debian 10 and newer
+ - auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python3' and distro_version is version('10', '>=') or distro_version is version('10', '<')
+ when: distro == 'debian'
- name: fedora assertions
assert: