scripts don't check return code
-------------------------------

                 Key: SOLR-62
                 URL: http://issues.apache.org/jira/browse/SOLR-62
             Project: Solr
          Issue Type: Bug
          Components: replication
            Reporter: Yonik Seeley
            Priority: Minor


Solr scripts that post commands to solr don't check the return code.

The scripts (like optimize) currently follow this pattern:

rs=`curl http://localhost:5051/update -s -d "<optimize/>"`
if [[ $? != 0 ]]
then
  [...]
fi

# check status of optimize request
rc=`echo $rs|cut -f2 -d'"'`
if [[ $? != 0 ]]
then
  [...]

$rc is never checked.  In addition, the line that grabs rc appears pretty
fragile by depending on an exact field column.  Unless we have a simple command
line XML parser, how about checking for the return code this way:

echo $rs | grep '<response.*status="0"' > /dev/null 2>&1
if [[ $? != 0 ]]
then
  [...]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to