From 59fa3bb120a36c231579eab757b6e54ff62c51b7 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Sun, 21 Jul 2024 22:12:04 +0200 Subject: live: improve logging for file removal from cache Provide a bit more logging to make it easier to debug issues. --- src/live/ogOperations.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/live') diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 5417a7c..44d8f1b 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -610,12 +610,16 @@ class OgLiveOperations: images = request.getImages() deleted_images = [] + logging.info(f'Request to remove files from cache') + if not mount_cache(): + logging.error(f'Cache is not mounted') return img_dir = OG_CACHE_IMAGE_PATH if not os.path.isdir(img_dir): + logging.error(f'{img_dir} is not a directory') return cache_contents for file_name in os.listdir(img_dir): @@ -630,20 +634,22 @@ class OgLiveOperations: continue if file_name in images: + logging.info(f'Removing file {file_path} from cache') os.remove(file_path) csum_path = file_path + '.full.sum' if not os.path.isfile(csum_path): - logging.info(f'Missing checksum file for {file_path}') + logging.info(f'Missing checksum file {csum_path}') continue + logging.info(f'Removing checksum file {csum_path} from cache') os.remove(csum_path) result = {'cache': self._get_cache_contents()} self._restartBrowser(self._url) - logging.info('Sending response to cache/delete request') + logging.info('Delete file from cache request OK') return result def refresh(self, ogRest): -- cgit v1.2.3-18-g5258