exit cleanup in functions
we should always use die instead of exit so that we know why we failed. Also remove instances where exit is called after die, as that is a noop. Change-Id: I8e08cce63d35c503c36ff1e09805f3db427d082d
This commit is contained in:
parent
ff38d464e4
commit
dc30bd3eb4
11
functions
11
functions
@ -580,7 +580,8 @@ function git_clone {
|
|||||||
if echo $GIT_REF | egrep -q "^refs"; then
|
if echo $GIT_REF | egrep -q "^refs"; then
|
||||||
# If our branch name is a gerrit style refs/changes/...
|
# If our branch name is a gerrit style refs/changes/...
|
||||||
if [[ ! -d $GIT_DEST ]]; then
|
if [[ ! -d $GIT_DEST ]]; then
|
||||||
[[ "$ERROR_ON_CLONE" = "True" ]] && exit 1
|
[[ "$ERROR_ON_CLONE" = "True" ]] && \
|
||||||
|
die $LINENO "Cloning not allowed in this configuration"
|
||||||
git clone $GIT_REMOTE $GIT_DEST
|
git clone $GIT_REMOTE $GIT_DEST
|
||||||
fi
|
fi
|
||||||
cd $GIT_DEST
|
cd $GIT_DEST
|
||||||
@ -588,7 +589,8 @@ function git_clone {
|
|||||||
else
|
else
|
||||||
# do a full clone only if the directory doesn't exist
|
# do a full clone only if the directory doesn't exist
|
||||||
if [[ ! -d $GIT_DEST ]]; then
|
if [[ ! -d $GIT_DEST ]]; then
|
||||||
[[ "$ERROR_ON_CLONE" = "True" ]] && exit 1
|
[[ "$ERROR_ON_CLONE" = "True" ]] && \
|
||||||
|
die $LINENO "Cloning not allowed in this configuration"
|
||||||
git clone $GIT_REMOTE $GIT_DEST
|
git clone $GIT_REMOTE $GIT_DEST
|
||||||
cd $GIT_DEST
|
cd $GIT_DEST
|
||||||
# This checkout syntax works for both branches and tags
|
# This checkout syntax works for both branches and tags
|
||||||
@ -612,8 +614,7 @@ function git_clone {
|
|||||||
elif [[ -n "`git show-ref refs/remotes/origin/$GIT_REF`" ]]; then
|
elif [[ -n "`git show-ref refs/remotes/origin/$GIT_REF`" ]]; then
|
||||||
git_update_remote_branch $GIT_REF
|
git_update_remote_branch $GIT_REF
|
||||||
else
|
else
|
||||||
echo $GIT_REF is neither branch nor tag
|
die $LINENO "$GIT_REF is neither branch nor tag"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -1562,7 +1563,6 @@ function _ping_check_novanet() {
|
|||||||
else
|
else
|
||||||
die $LINENO "[Fail] Could ping server"
|
die $LINENO "[Fail] Could ping server"
|
||||||
fi
|
fi
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1575,7 +1575,6 @@ function get_instance_ip(){
|
|||||||
if [[ $ip = "" ]];then
|
if [[ $ip = "" ]];then
|
||||||
echo "$nova_result"
|
echo "$nova_result"
|
||||||
die $LINENO "[Fail] Coudn't get ipaddress of VM"
|
die $LINENO "[Fail] Coudn't get ipaddress of VM"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
echo $ip
|
echo $ip
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user