Use shutil.move instead of path rename when moving discarded captures

pull/390/head
Kimmo Linnavuo 2022-04-08 15:28:06 +03:00
parent 981d569298
commit a80b6a31e4
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@
import logging import logging
import os import os
from datetime import datetime, timedelta from datetime import datetime, timedelta
import shutil
from lookyloo.default import AbstractManager from lookyloo.default import AbstractManager
from lookyloo.exceptions import MissingUUID, NoValidHarFile from lookyloo.exceptions import MissingUUID, NoValidHarFile
@ -61,7 +62,7 @@ class BackgroundIndexer(AbstractManager):
self.logger.warning(f'Unable to build pickle for {uuid}: {uuid_path.parent.name}') self.logger.warning(f'Unable to build pickle for {uuid}: {uuid_path.parent.name}')
# The capture is not working, moving it away. # The capture is not working, moving it away.
self.lookyloo.redis.hdel('lookup_dirs', uuid) self.lookyloo.redis.hdel('lookup_dirs', uuid)
uuid_path.parent.rename(self.discarded_captures_dir / uuid_path.parent.name) shutil.move(uuid_path.parent, (self.discarded_captures_dir / uuid_path.parent.name))
def _check_indexes(self): def _check_indexes(self):
index_redis = self.lookyloo.indexing.redis index_redis = self.lookyloo.indexing.redis