Perry Myers
2009-Jan-19 08:26 UTC
[Ovirt-devel] [PATCH node] o-c-setup now catches and reports failures from called sub-scripts
Signed-off-by: Perry Myers <pmyers at redhat.com> --- scripts/ovirt-config-setup | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup index 21e6b0e..3d1292f 100755 --- a/scripts/ovirt-config-setup +++ b/scripts/ovirt-config-setup @@ -40,7 +40,15 @@ while true; do "$CONTINUE") exit 0 ;; *) clear; - $CONFIG_DIR/*"$OPTION" 2>&1 | $TEE; + { + $CONFIG_DIR/*"$OPTION" + if [ $? = 0 ]; then + printf "\n$OPTION Completed Successfully\n\n" + else + printf "\nERROR: $OPTION FAILED. " + printf "See $OVIRT_LOGFILE\n\n" + fi + } 2>&1 | $TEE; break ;; esac done -- 1.6.0.6
Alan Pevec
2009-Jan-19 12:46 UTC
[Ovirt-devel] [PATCH node] o-c-setup now catches and reports failures from called sub-scripts
ack and pushed w/ a small change Jim suggested in the other review: + if $CONFIG_DIR/*"$OPTION" ; then instead of + $CONFIG_DIR/*"$OPTION"> + if [ $? = 0 ]; then > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20090119/121d56fc/attachment.htm>
Jim Meyering
2009-Jan-19 13:30 UTC
[Ovirt-devel] [PATCH node] o-c-setup now catches and reports failures from called sub-scripts
Perry Myers <pmyers at redhat.com> wrote:> diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup > index 21e6b0e..3d1292f 100755 > --- a/scripts/ovirt-config-setup > +++ b/scripts/ovirt-config-setup > @@ -40,7 +40,15 @@ while true; do > "$CONTINUE") exit 0 ;; > *) > clear; > - $CONFIG_DIR/*"$OPTION" 2>&1 | $TEE; > + { > + $CONFIG_DIR/*"$OPTION" > + if [ $? = 0 ]; then > + printf "\n$OPTION Completed Successfully\n\n" > + else > + printf "\nERROR: $OPTION FAILED. " > + printf "See $OVIRT_LOGFILE\n\n" > + fi > + } 2>&1 | $TEE; > break ;; > esac > doneACK, but put command and result-test on the same line, e.g., use this (also factoring out the printing and formatting): if $CONFIG_DIR/*"$OPTION; then msg="$OPTION Completed Successfully" else msg="ERROR: $OPTION FAILED. See $OVIRT_LOGFILE" fi printf "\n%s\n\n" "$msg" or this: $CONFIG_DIR/*"$OPTION \ && msg="$OPTION Completed Successfully" \ || msg="ERROR: $OPTION FAILED. See $OVIRT_LOGFILE" printf "\n%s\n\n" "$msg"