tape-admin: change return-code value from 1st level functions
- if a call to a secondary function returns an error, terminate the calling function with exit code 1 Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -846,9 +846,9 @@ ltfs_reformat () {
|
|||||||
ltfs_umount
|
ltfs_umount
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
ltfs_wipe
|
ltfs_wipe
|
||||||
#if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
ltfs_format ${volume_name_active} ${volume_serial}
|
ltfs_format ${volume_name_active} ${volume_serial}
|
||||||
#fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@@ -1147,7 +1147,7 @@ mount_tape () {
|
|||||||
mtx_load ${volume_slot}
|
mtx_load ${volume_slot}
|
||||||
ltfs_mount
|
ltfs_mount
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -2179,7 +2179,7 @@ case $cmd in
|
|||||||
printf "${RED}Error: ${MAGENTA}Could not update RetensionDate for ${GREEN}'%s'${MAGENTA} in media-pool ${GREEN}%s${NO_COLOR}\n" \
|
printf "${RED}Error: ${MAGENTA}Could not update RetensionDate for ${GREEN}'%s'${MAGENTA} in media-pool ${GREEN}%s${NO_COLOR}\n" \
|
||||||
"${volume_name}" "${mediapool_name}"
|
"${volume_name}" "${mediapool_name}"
|
||||||
fi
|
fi
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
date_string_to_iso "${volume_retensiondate}"
|
date_string_to_iso "${volume_retensiondate}"
|
||||||
if [ $? -eq 0 ] && ! $quiet; then
|
if [ $? -eq 0 ] && ! $quiet; then
|
||||||
@@ -2208,7 +2208,7 @@ case $cmd in
|
|||||||
get-mediapolicy)
|
get-mediapolicy)
|
||||||
get_mediapolicy "${mediapool_name}" "${volume_name}"
|
get_mediapolicy "${mediapool_name}" "${volume_name}"
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
printf "${MAGENTA}MediaPolicy for ${GREEN}'%s'${MAGENTA} is:${NO_COLOR}'%s'.\n" \
|
printf "${MAGENTA}MediaPolicy for ${GREEN}'%s'${MAGENTA} is:${NO_COLOR}'%s'.\n" \
|
||||||
@@ -2230,7 +2230,7 @@ case $cmd in
|
|||||||
get-mediapools)
|
get-mediapools)
|
||||||
get_mediapool_names
|
get_mediapool_names
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
printf "${MAGENTA}MediaPool names: ${GREEN}'%s'${NO_COLOR}\n" \
|
printf "${MAGENTA}MediaPool names: ${GREEN}'%s'${NO_COLOR}\n" \
|
||||||
@@ -2322,7 +2322,7 @@ case $cmd in
|
|||||||
ltfs-is-mounted)
|
ltfs-is-mounted)
|
||||||
ltfs_is_mounted
|
ltfs_is_mounted
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
printf "${MAGENTA}LTFS Tape is-mounted: ${GREEN}true${NO_COLOR}\n"
|
printf "${MAGENTA}LTFS Tape is-mounted: ${GREEN}true${NO_COLOR}\n"
|
||||||
@@ -2332,7 +2332,7 @@ case $cmd in
|
|||||||
ltfs-mount)
|
ltfs-mount)
|
||||||
ltfs_mount
|
ltfs_mount
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
printf "${MAGENTA}LTFS Tape mount: ${GREEN}true${NO_COLOR}\n"
|
printf "${MAGENTA}LTFS Tape mount: ${GREEN}true${NO_COLOR}\n"
|
||||||
@@ -2353,7 +2353,7 @@ case $cmd in
|
|||||||
ltfs-umount)
|
ltfs-umount)
|
||||||
ltfs_umount
|
ltfs_umount
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
printf "${MAGENTA}LTFS Tape unmount: ${GREEN}true${NO_COLOR}\n"
|
printf "${MAGENTA}LTFS Tape unmount: ${GREEN}true${NO_COLOR}\n"
|
||||||
@@ -2379,7 +2379,7 @@ case $cmd in
|
|||||||
mount)
|
mount)
|
||||||
mount_tape "${mediapool_name}" "${volume_name}"
|
mount_tape "${mediapool_name}" "${volume_name}"
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
if test ${#volume_name} -ge 1; then
|
if test ${#volume_name} -ge 1; then
|
||||||
@@ -2394,36 +2394,36 @@ case $cmd in
|
|||||||
;;
|
;;
|
||||||
mtx-exchange)
|
mtx-exchange)
|
||||||
mtx_exchange "${slot_source}" "${slot_target}"
|
mtx_exchange "${slot_source}" "${slot_target}"
|
||||||
return $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
mtx-getlabel)
|
mtx-getlabel)
|
||||||
mtx_getlabel $slot_source
|
mtx_getlabel $slot_source
|
||||||
return $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
mtx-inventory)
|
mtx-inventory)
|
||||||
mtx_inventory
|
mtx_inventory
|
||||||
return $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
mtx-load)
|
mtx-load)
|
||||||
mtx_load "${slot_source}" "${drive}"
|
mtx_load "${slot_source}" "${drive}"
|
||||||
return $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
mtx-status)
|
mtx-status)
|
||||||
mtx_status "${slot_source}" "${slot_target}"
|
mtx_status "${slot_source}" "${slot_target}"
|
||||||
return $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
mtx-transfer)
|
mtx-transfer)
|
||||||
mtx_transfer "${slot_source}" "${slot_target}"
|
mtx_transfer "${slot_source}" "${slot_target}"
|
||||||
return $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
mtx-unload)
|
mtx-unload)
|
||||||
mtx_unload "${slot_source}" "${drive}"
|
mtx_unload "${slot_source}" "${drive}"
|
||||||
return $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
update-lastwrite)
|
update-lastwrite)
|
||||||
update_lastwrite "${mediapool_name}" "${volume_name}" "${date_string}"
|
update_lastwrite "${mediapool_name}" "${volume_name}" "${date_string}"
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
date_string_to_iso "${volume_lastwrite}"
|
date_string_to_iso "${volume_lastwrite}"
|
||||||
@@ -2438,7 +2438,7 @@ case $cmd in
|
|||||||
update-mediapool-retensiondays)
|
update-mediapool-retensiondays)
|
||||||
update_mediapool_retensiondays "${mediapool_name}" "${mediapool_defaultretensiondays}"
|
update_mediapool_retensiondays "${mediapool_name}" "${mediapool_defaultretensiondays}"
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
printf "${MAGENTA}New DefaultRetensionDays attribute for ${GREEN}'%s'${MAGENTA} is: ${NO_COLOR}'%s'.\n" \
|
printf "${MAGENTA}New DefaultRetensionDays attribute for ${GREEN}'%s'${MAGENTA} is: ${NO_COLOR}'%s'.\n" \
|
||||||
@@ -2449,7 +2449,7 @@ case $cmd in
|
|||||||
update-retensiondate)
|
update-retensiondate)
|
||||||
update_retensiondate "${mediapool_name}" "${volume_name}" "${date_string}"
|
update_retensiondate "${mediapool_name}" "${volume_name}" "${date_string}"
|
||||||
if test $? -gt 0; then
|
if test $? -gt 0; then
|
||||||
return 1
|
exit 1
|
||||||
else
|
else
|
||||||
if ! $quiet; then
|
if ! $quiet; then
|
||||||
date_string_to_iso "${volume_retensiondate}"
|
date_string_to_iso "${volume_retensiondate}"
|
||||||
|
|||||||
Reference in New Issue
Block a user