From 5b38fbfc23a8e518ccb90e71858763d3f590bedc Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Thu, 6 Feb 2020 13:25:19 +0000
Subject: [PATCH] CI: Use auto-detected python interpreter except on CentOS 7

This switches to python 3 as the remote python interpreter on
Debian/Ubuntu jobs, with CentOS 7 as the only exception using python 2.

Also switch to auto-detection of the interpeter except for CentOS 7,
which should be based on the one used by ansible-playbook (python 3).

Change-Id: Ie4aff6123dfc7267fe78f4bd736565fb72fe135e
Partially-Implements: python-3
---
 tests/templates/globals-default.j2 | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2
index 7a258298f1..ec42488f45 100644
--- a/tests/templates/globals-default.j2
+++ b/tests/templates/globals-default.j2
@@ -1,9 +1,11 @@
 ---
-# Force the use of python2 on Ubuntu/Debian and CentOS7 remote hosts. This is
-# necessary for delegate_to: localhost, which will otherwise use the local
-# python interpreter (python3).  On CentOS 7, that fails due to a lack of
-# python3 bindings for SELinux.  https://bugs.centos.org/view.php?id=16389
-ansible_python_interpreter: /usr/bin/python{{ '2' if ansible_os_family != 'RedHat' or ansible_distribution_major_version == '7' else '3' }}
+{% if ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7' %}
+# Force the use of python2 on CentOS7 remote hosts. This is necessary for
+# delegate_to: localhost, which will otherwise use the local python interpreter
+# (python3).  On CentOS 7, that fails due to a lack of python3 bindings for
+# SELinux.  https://bugs.centos.org/view.php?id=16389
+ansible_python_interpreter: /usr/bin/python2
+{% endif %}
 
 kolla_base_distro: "{{ base_distro }}"
 kolla_install_type: "{{ install_type }}"