Backport 'Check that generate-subunit exists'

The python-glanceclient functional tests in stable/pike have run into
a devstack issue [0] that was fixed in master, so backporting the fix
and a followup correction:
Check that generate-subunit exists before using it
(cherry picked from commit cbd5f4e0ad)
Fix comment wording nit
(cherry picked from commit 03ae3c485e)

[0] Log extract from https://review.openstack.org/#/c/529834/
2017-12-22 19:16:02.880 | Error on exit
2017-12-22 19:16:02.881 | ./stack.sh: line 540: generate-subunit:
                            command not found
ERROR
{
  "delta": "0:00:03.150918",
  "end": "2017-12-22 19:16:02.898596",
  "failed": true,
  "rc": 127,
  "start": "2017-12-22 19:15:59.747678"
}

Change-Id: I0fecb027e5be6f4d7bb0bf34e59a43543a421f38
Needed-by: Idaa2f4b920e131320499c9e460ade74df1d5a264
This commit is contained in:
Monty Taylor 2017-09-10 15:00:29 -06:00 committed by Ian Wienand
parent 058700039b
commit b711396805
1 changed files with 8 additions and 2 deletions

View File

@ -537,14 +537,20 @@ function exit_trap {
if [[ $r -ne 0 ]]; then
echo "Error on exit"
generate-subunit $DEVSTACK_START_TIME $SECONDS 'fail' >> ${SUBUNIT_OUTPUT}
# If we error before we've installed os-testr, this will fail.
if type -p generate-subunit > /dev/null; then
generate-subunit $DEVSTACK_START_TIME $SECONDS 'fail' >> ${SUBUNIT_OUTPUT}
fi
if [[ -z $LOGDIR ]]; then
$TOP_DIR/tools/worlddump.py
else
$TOP_DIR/tools/worlddump.py -d $LOGDIR
fi
else
generate-subunit $DEVSTACK_START_TIME $SECONDS >> ${SUBUNIT_OUTPUT}
# If we error before we've installed os-testr, this will fail.
if type -p generate-subunit > /dev/null; then
generate-subunit $DEVSTACK_START_TIME $SECONDS >> ${SUBUNIT_OUTPUT}
fi
fi
exit $r