[ovs-dev] [PATCH] ovs-lib: Return the exit status of ovs-ctl in ovs_ctl()
Duffie Cooley
dcooley at nicira.com
Wed Oct 2 16:39:51 UTC 2013
Signed-off-by: Duffie Cooley <dcooley at nicira.com>
Thanks!
Duffie
On Oct 2, 2013 7:56 AM, "Gurucharan Shetty" <shettyg at nicira.com> wrote:
> Duffie,
> I will need a Signed-off-by by you.
> (I do not see a Authored-by convention used anywhere. So I put you as
> Co-authored-by. If there is such a thing, I will change it.)
>
> On Wed, Oct 2, 2013 at 7:20 AM, Gurucharan Shetty <shettyg at nicira.com>
> wrote:
> > commit 46528f78e5c(debian, rhel, xenserver: Ability to collect ovs-ctl
> logs)
> > made changes in the startup scripts such that the o/p of ovs-ctl is
> logged
> > into ovs-ctl.log. But it had an unintended consequence that the exit
> status
> > of ovs-ctl was no longer returned. We would always return success(the
> exit
> > status of tee).
> >
> > With this commit, we return the exit status of ovs-ctl instead of tee.
> > Code referenced from: (line wrapped).
> > http://unix.stackexchange.com/questions/14270/\
> > get-exit-status-of-process-thats-piped-to-another/70675#70675)
> >
> > Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
> > Co-authored-by: Duffie Cooley <dcooley at nicira.com>
> > ---
> > utilities/ovs-lib.in | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
> > index 1684ddc..7e339b3 100644
> > --- a/utilities/ovs-lib.in
> > +++ b/utilities/ovs-lib.in
> > @@ -41,6 +41,11 @@ ovs_ctl_log () {
> > echo "$@" >> "${logdir}/ovs-ctl.log"
> > }
> >
> > +stdintoexitstatus () {
> > + read exitstatus
> > + return $exitstatus
> > +}
> > +
> > ovs_ctl () {
> > case "$@" in
> > *"=strace"*)
> > @@ -51,7 +56,9 @@ ovs_ctl () {
> > ;;
> > *)
> > echo "`date -u`:$@" >> "${logdir}/ovs-ctl.log"
> > - "${datadir}/scripts/ovs-ctl" "$@" 2>&1 | tee -a
> "${logdir}/ovs-ctl.log"
> > + ( ( ( ( ("${datadir}/scripts/ovs-ctl" "$@" 2>&1 ; echo $?
> >&3) \
> > + | tee -a "${logdir}/ovs-ctl.log") >&4) 3>&1) |
> stdintoexitstatus) \
> > + 4>&1
> > ;;
> > esac
> > }
> > --
> > 1.7.9.5
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20131002/285a21d6/attachment-0003.html>
More information about the dev
mailing list