fix: Avoid exception on empty dir in archiver.

pull/759/head
Raphaël Vinot 2023-08-16 11:15:00 +02:00
parent 13256c6166
commit d0d08b5882
1 changed files with 4 additions and 0 deletions

View File

@ -81,6 +81,10 @@ class Archiver(AbstractManager):
if not capture_dir.is_dir():
self.logger.warning(f'{capture_dir} is not a directory')
continue
if not next(capture_dir.iterdir(), None):
self.logger.warning(f'{capture_dir} is empty, removing.')
capture_dir.rmdir()
continue
uuid_file = capture_dir / 'uuid'
if not uuid_file.exists():
self.logger.warning(f'No UUID file in {capture_dir}.')