def __delete_old(self, backup): if utils.date_cmp(backup.makingtime, inc_backup_lifetime) and (backup.kind == 'inc'): backup.purge() self.wdb.delete_old(backup) if utils.date_cmp(backup.makingtime, full_backup_lifetime) and (backup.kind == 'full'): backup.purge() self.wdb.delete_old(backup)
def __backup_choise(self, server, backup_match): last_backup = max([backup for backup in backup_match]) if utils.date_cmp(last_backup.makingtime, time_before_repeat) is not True: logger.info('[%s] backup state is actual' % (server.name)) return if datetime.date.isoweekday(datetime.date.today()) == 1: self.__backup_full(server) else: last_full_backup = self.__finding_last_backup(backup_match) if last_full_backup is None: self.__backup_full(server) elif (os.path.isdir(last_full_backup.realpath) is True) and (os.path.exists(last_full_backup.file_path) is True): self.__backup_inc(server, last_full_backup) else: self.__backup_full(server)
def __packing_old(self, backup): if utils.date_cmp(backup.makingtime, time_before_packing): if os.path.isdir(backup.realpath) is True: backup.packing() self.wdb.session_save(backup)