mirror of https://github.com/CIRCL/lookyloo
chg: Cleanup when dir is moved, digit months on 2 values
parent
b8109c6462
commit
53ceb9c329
|
@ -54,7 +54,7 @@ class Archiver(AbstractManager):
|
||||||
archived_uuids = {}
|
archived_uuids = {}
|
||||||
for year, month_captures in to_archive.items():
|
for year, month_captures in to_archive.items():
|
||||||
for month, captures in month_captures.items():
|
for month, captures in month_captures.items():
|
||||||
dest_dir = archived_captures_dir / str(year) / str(month)
|
dest_dir = archived_captures_dir / str(year) / f'{month:02}'
|
||||||
dest_dir.mkdir(parents=True, exist_ok=True)
|
dest_dir.mkdir(parents=True, exist_ok=True)
|
||||||
if (dest_dir / 'index').exists():
|
if (dest_dir / 'index').exists():
|
||||||
with (dest_dir / 'index').open('r') as _f:
|
with (dest_dir / 'index').open('r') as _f:
|
||||||
|
@ -74,6 +74,7 @@ class Archiver(AbstractManager):
|
||||||
lookyloo.redis.hdel('lookup_dirs', *archived_uuids.keys())
|
lookyloo.redis.hdel('lookup_dirs', *archived_uuids.keys())
|
||||||
lookyloo.redis.hset('lookup_dirs_archived', mapping=archived_uuids)
|
lookyloo.redis.hset('lookup_dirs_archived', mapping=archived_uuids)
|
||||||
lookyloo.clear_captures_index_cache(archived_uuids.keys())
|
lookyloo.clear_captures_index_cache(archived_uuids.keys())
|
||||||
|
self.logger.info('Archiving done.')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -624,6 +624,7 @@ class Lookyloo():
|
||||||
capture_dir = self._captures_index[capture_uuid].capture_dir
|
capture_dir = self._captures_index[capture_uuid].capture_dir
|
||||||
if capture_dir.exists():
|
if capture_dir.exists():
|
||||||
return capture_dir
|
return capture_dir
|
||||||
|
self.redis.delete(capture_dir)
|
||||||
self._captures_index.pop(capture_uuid)
|
self._captures_index.pop(capture_uuid)
|
||||||
capture_dir = self.redis.hget('lookup_dirs', capture_uuid)
|
capture_dir = self.redis.hget('lookup_dirs', capture_uuid)
|
||||||
if capture_dir and not Path(capture_dir).exists():
|
if capture_dir and not Path(capture_dir).exists():
|
||||||
|
|
Loading…
Reference in New Issue