bug 7288: report errors and bail

status 7288 resolved fixed
This commit is contained in:
Chiradeep Vittal 2011-01-18 14:11:19 -08:00
parent 2188450fb0
commit f1880942c3
2 changed files with 8 additions and 5 deletions

View File

@ -147,7 +147,6 @@ if [ -n "$cksum" ]
then then
verify_cksum $cksum $tmpltimg verify_cksum $cksum $tmpltimg
fi fi
tmpltimg2=$(uncompress $tmpltimg) tmpltimg2=$(uncompress $tmpltimg)
rollback_if_needed $tmpltfs $? "failed to uncompress $tmpltimg\n" rollback_if_needed $tmpltfs $? "failed to uncompress $tmpltimg\n"
@ -156,10 +155,10 @@ rollback_if_needed $tmpltfs $? "tar archives not supported\n"
if [ ${tmpltname%.vhd} != ${tmpltname} ] if [ ${tmpltname%.vhd} != ${tmpltname} ]
then then
if which vhd-util 2>/dev/null if which vhd-util &>/dev/null
then then
vhd-util check -n ${tmpltimg2} > /dev/null vhd-util check -n ${tmpltimg2} > /dev/null
rollback_if_needed $tmpltfs $? "vhd tool check $tmpltimg2 failed\n" rollback_if_needed $tmpltfs $? "vhd check of $tmpltimg2 failed\n"
fi fi
fi fi

View File

@ -89,6 +89,7 @@ mkdir -p $destdir
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
printf "Failed to write to mount point $mntpoint -- is it mounted?\n" printf "Failed to write to mount point $mntpoint -- is it mounted?\n"
exit 3
fi fi
if [ "$Fflag" == "1" ] if [ "$Fflag" == "1" ]
@ -120,6 +121,7 @@ touch $tmpfile
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
printf "Failed to create temporary file in directory $(dirname $0) -- is it read-only or full?\n" printf "Failed to create temporary file in directory $(dirname $0) -- is it read-only or full?\n"
exit 4
fi fi
if [ "$uflag" == "1" ] if [ "$uflag" == "1" ]
@ -139,15 +141,17 @@ then
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
printf "Failed to create temporary file in directory $(dirname $0) -- is it read-only or full?\n" printf "Failed to create temporary file in directory $(dirname $0) -- is it read-only or full?\n"
exit 6
fi fi
fi fi
$(dirname $0)/createtmplt.sh -s 2 -d 'SystemVM Template' -n $localfile -t $destdir/ -f $tmpfile -u &> /dev/null installrslt=$($(dirname $0)/createtmplt.sh -s 2 -d 'SystemVM Template' -n $localfile -t $destdir/ -f $tmpfile -u)
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Failed to install system vm template $tmpltimg to $destdir" echo "Failed to install system vm template $tmpltimg to $destdir: $installrslt"
exit 7
fi fi
if [ "$ext" == "ova" ] if [ "$ext" == "ova" ]