[MOS10.0][DEB] Update ceilometer to v7.0.0
[openstack-build/ceilometer-build.git] / xenial / debian / functions.sh
1 function clean_exit(){
2     local error_code="$?"
3     rm -rf "$1"
4     kill $(jobs -p)
5     return $error_code
6 }
7
8 check_for_cmd () {
9     if ! which "$1" >/dev/null 2>&1
10     then
11         echo "Could not find $1 command" 1>&2
12         exit 1
13     fi
14 }
15
16 wait_for_line () {
17     exit_code=1
18     while read line
19     do
20         echo "$line" | grep -q "$1" && exit_code=0 && break
21     done < "$2"
22     # Read the fifo for ever otherwise process would block
23     cat "$2" >/dev/null &
24     if [ $exit_code -eq 1 ]; then
25         echo "Entries of \"$1\" have not been found. Now tests will be stopped."
26         exit $exit_code
27     fi
28 }
29