diff options
| author | Mark Goddard <mark@stackhpc.com> | 2020-03-16 16:18:42 +0000 |
|---|---|---|
| committer | Mark Goddard <mark@stackhpc.com> | 2020-04-20 16:18:31 +0000 |
| commit | 284f492861835a9616eb53a65a9648e415388cc9 (patch) | |
| tree | 1092afccc428b6e8580014eb78eeeee44a31481e /tools | |
| parent | f4e20a1f16b3c2d2adb1d516df80950e197a374d (diff) | |
| download | kolla-ansible-284f492861835a9616eb53a65a9648e415388cc9.tar.gz kolla-ansible-284f492861835a9616eb53a65a9648e415388cc9.zip | |
Remove support for Python 2 on the host
Drops support for creating Python 2 virtualenvs in bootstrap-servers,
and looking for a python2 interpreter in the kolla-ansible script.
Also forces the use of Python 3 as the remote interpreter in CI on
Debian and Ubuntu hosts, since they typically symlink the unversioned
interpreter to python2.7.
Change-Id: Id0e977de381e7faafed738674a140ba36184727e
Partially-Implements: blueprint drop-py2-support
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/kolla-ansible | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/tools/kolla-ansible b/tools/kolla-ansible index 4322c9cb0..1afc41757 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -15,10 +15,7 @@ function check_ansible_compatibility { } function find_base_dir { - # $1: Python interpreter - local python - python=$1 - local real_path=$($python -c "import os;print(os.path.realpath('$0'))") + local real_path=$(python3 -c "import os;print(os.path.realpath('$0'))") local dir_name="$(dirname "$real_path")" if [ -z "$SNAP" ]; then if [[ ${dir_name} == "/usr/bin" ]]; then @@ -142,21 +139,15 @@ LONG_OPTS="help,inventory:,playbook:,skip-tags:,tags:,key:,extra:,verbose,config RAW_ARGS="$*" ARGS=$(getopt -o "${SHORT_OPTS}" -l "${LONG_OPTS}" --name "$0" -- "$@") || { usage >&2; exit 2; } -# Detect which python interpreter to use. -for python in python3 python2; do - if $python -c 'import kolla_ansible' &>/dev/null; then - PYTHON=$python - break - fi -done -if [[ -z $PYTHON ]]; then +# Check for existence of kolla_ansible module using python3 interpreter. +if ! python3 -c 'import kolla_ansible' &>/dev/null; then echo "ERROR: kolla_ansible has to be available in the PYTHONPATH (e.g. installed)" >&2 exit 1 fi eval set -- "$ARGS" -find_base_dir $PYTHON +find_base_dir INVENTORY="${BASEDIR}/ansible/inventory/all-in-one" PLAYBOOK="${BASEDIR}/ansible/site.yml" |
