From 04c0f0be2643ef95380a7dcf4b510d86ff11cd58 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 30 Jun 2015 13:47:51 +1000 Subject: [PATCH] Move failure trap after functions it uses Move the failure trap after the functions it uses, so that "delete_all" is defined when it is triggered. Change-Id: Icb2465d0f834b8cb2d46dca3c7df4ae06e49d9b5 --- exercises/neutron-adv-test.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/exercises/neutron-adv-test.sh b/exercises/neutron-adv-test.sh index 04892b0e93..a0de4ccd37 100755 --- a/exercises/neutron-adv-test.sh +++ b/exercises/neutron-adv-test.sh @@ -19,18 +19,6 @@ echo "*********************************************************************" set -o errtrace -trap failed ERR -function failed { - local r=$? - set +o errtrace - set +o xtrace - echo "Failed to execute" - echo "Starting cleanup..." - delete_all - echo "Finished cleanup" - exit $r -} - # Print the commands being run so that we can see the command that triggers # an error. It is also useful for following allowing as the install occurs. set -o xtrace @@ -441,6 +429,18 @@ function main { fi } +trap failed ERR +function failed { + local r=$? + set +o errtrace + set +o xtrace + echo "Failed to execute" + echo "Starting cleanup..." + delete_all + echo "Finished cleanup" + exit $r +} + # Kick off script # ---------------