Exemple #1
0
def rebuild():
    """
    Rebuilds the db either by using PickleDBRecover or XMLDBRecover
    """
    strategies = [PickleDBRecover(), XMLDBRecover()]
    for strategy in strategies:
        logging.info('(!!) Probing strategy: ' + strategy.description)
        metalist = strategy.load()
        if metalist:
            while True:
                try:
                    logging.info('-> Success! Generating Database.')
                    d = DBGenerator(metalist)
                    d.batch()
                    d.close()
                    logging.info('Making sure everything is clean on master..')
                    repair()
                    break
                except KeyboardInterrupt:
                    print('Got Interrupt. Please wait till DB Query is done.')
            break
 def handle_repair(self):
     """
     Invokes archive rapair tool
     """
     self.__filelock.acquire()
     repair()