IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32139


Ignore:
Timestamp:
Aug 19, 2011, 11:45:38 AM (15 years ago)
Author:
rhenders
Message:

remove() method is now returning true if the batch is not found on the datastore; log messged demoted to 'debug' from 'info'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/datastore.py

    r32120 r32139  
    55import logging
    66import sys
     7import re
    78from xml.etree.ElementTree import ElementTree, Element, tostring
    89
     
    6364    '''
    6465    Removes an item from the datastore
     66
     67    NB this will return a success if the batch is not found on the datastore
    6568    '''
    6669    def remove(self, name):
     
    7174                   --product " + self.product
    7275
    73         p = Popen(command, shell=True, stdout=PIPE)
     76        p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
    7477        p.wait()
     78        output, errors = p.communicate()
    7579
    7680        if p.returncode != 0:
    77             self.logger.errorPair("Datastore removal failed",  name)
    78             ret = False
     81            if re.search("not found in", errors):
     82                self.logger.debugPair("Datastore batch not found", name)
     83                ret = True
     84            else:
     85                self.logger.debugPair("Datastore removal FAILED", name)
     86                ret = False
    7987        else:
     88            self.logger.debugPair("Datastore removal successful", name)
    8089            ret = True
    81             self.logger.infoPair("Datastore removal successful", name)
    8290           
    8391        return ret
Note: See TracChangeset for help on using the changeset viewer.