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
This commit is contained in:
Radosław Piliszek 2019-10-26 15:09:15 +02:00
parent ade4f4eeb4
commit af7305f2aa

View File

@ -120,6 +120,11 @@ LONG_OPTS="help,inventory:,playbook:,skip-tags:,tags:,key:,extra:,verbose,config
RAW_ARGS="$*" RAW_ARGS="$*"
ARGS=$(getopt -o "${SHORT_OPTS}" -l "${LONG_OPTS}" --name "$0" -- "$@") || { usage >&2; exit 2; } 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" eval set -- "$ARGS"
find_base_dir find_base_dir