From af7305f2aaf68ce9f485e78d269790f358dc7311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= Date: Sat, 26 Oct 2019 15:09:15 +0200 Subject: [PATCH] Fail kolla-ansible early when not available in the PYTHONPATH Starting with the Train release, kolla_ansible (the package) must be available in the PYTHONPATH to run most playbooks. It is documented. This change makes the error message friendlier. Change-Id: Icf0399d21b3fde8d530d73e6e7ee4a57665da276 Closes-bug: #1849943 --- tools/kolla-ansible | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/kolla-ansible b/tools/kolla-ansible index a60338c795..640a18ce20 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -120,6 +120,11 @@ 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; } +python -c 'import kolla_ansible' &>/dev/null || ( + echo "ERROR: kolla_ansible has to be available in the PYTHONPATH (e.g. installed)" >&2 + exit 1 +) + eval set -- "$ARGS" find_base_dir