devstack/tools/xen/scripts/on_exit.sh
John Garbutt daadf744ed Improvements to DevStack's XenServer scripts
I have ensured:
- template gets re-used on second run
- template includes XenServer tools, and custom user accounts
- take snapshot before first boot, for easy re-run
- make host_ip_iface work with either eth2 or eth3
- make ssh into domU checks looser
- above is all ground work for improved jenkins tests
- added some more comments to make it scripts clearer

Change-Id: I5c45370bf8a1393d669480e196b13f592d29154f
2012-05-22 18:12:43 +01:00

25 lines
325 B
Bash
Executable File

#!/bin/bash
set -e
set -o xtrace
declare -a on_exit_hooks
on_exit()
{
for i in $(seq $((${#on_exit_hooks[*]} - 1)) -1 0)
do
eval "${on_exit_hooks[$i]}"
done
}
add_on_exit()
{
local n=${#on_exit_hooks[*]}
on_exit_hooks[$n]="$*"
if [[ $n -eq 0 ]]
then
trap on_exit EXIT
fi
}