Permalink
Browse files

yet another lantorrent patch for 2.9

Here we test the output only if the return code was 0
  • Loading branch information...
1 parent e855e6c commit 27b10c1d8383250c0c5dd9e76e58b68434f02378 @buzztroll buzztroll committed Jan 26, 2012
Showing with 15 additions and 9 deletions.
  1. +12 −8 control/bin/ltclient.sh
  2. +3 −1 lantorrent/pylantorrent/request.py
View
@@ -49,9 +49,12 @@ do
thresh=30
out=`ssh -p $port $userhost "$remoteexe" --nonblock --reattach "$rid"`
rc=$?
- msgrc=`echo $out | awk -F , '{ print $1 }'`
- done=`echo $out | awk -F , '{ print $2 }'`
- message=`echo $out | awk -F , '{ print $3 }'`
+ # we only parse the output if the return code was 0
+ if [ $rc -eq 0 ]; then
+ rc=`echo $out | awk -F , '{ print $1 }'`
+ done=`echo $out | awk -F , '{ print $2 }'`
+ message=`echo $out | awk -F , '{ print $3 }'`
+ fi
echo $out
if [ $rc -ne 0 ]; then
ssh_error_cnt=`expr $ssh_error_cnt + 1`
@@ -89,11 +92,12 @@ while [ "X$done" == "XFalse" ];
do
out=`ssh -p $port $userhost "$remoteexe" --reattach "$rid"`
rc=$?
- done=`echo $out | awk -F , '{ print $2 }'`
- message=`echo $out | awk -F , '{ print $3 }'`
- echo $out
-
- echo "------> $done"
+ if [ $rc -eq 0 ]; then
+ rc=`echo $out | awk -F , '{ print $1 }'`
+ done=`echo $out | awk -F , '{ print $2 }'`
+ message=`echo $out | awk -F , '{ print $3 }'`
+ echo $out
+ fi
if [ $rc -ne 0 ]; then
if [ "X$done" == "XFalse" ]; then
@@ -195,7 +195,9 @@ def main(argv=sys.argv[1:]):
msg = "%d,%s,%s" % (rc, str(done), message)
print msg
- return rc
+ # always return 0 if we echo the rc to stdout. this tells the
+ # user to check the output for the real rc
+ return 0
if __name__ == "__main__":

0 comments on commit 27b10c1

Please sign in to comment.