Fix kolla_ansible python module check

The kolla-ansible script now (Train+) checks whether the kolla_ansible
python module is installed, and emits the following message if not:

ERROR: kolla_ansible has to be available in the PYTHONPATH (e.g.
installed)

It is supposed to exit 1 if this check fails, but does not.

This change fixes this by removing a subshell from the kolla-ansible
script.

Change-Id: I2c1a7398f2b8f876abcf2508874835154cb4ce57
Closes-Bug: #1854049
This commit is contained in:
Mark Goddard 2019-11-26 12:42:36 +00:00
parent cacf308170
commit 692d176cd5

View File

@ -120,10 +120,10 @@ 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 || (
if ! python -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"