From 51482296ff0c301a9e27ff545966856d0f847fde Mon Sep 17 00:00:00 2001 From: Yotam Gigi Date: Thu, 14 Sep 2017 09:59:44 +0300 Subject: [PATCH] Common: ResourceCache: Workaround issue #189 Workaround the issue of non existing cache entry when trying to delete. Signed-off-by: Yotam Gigi --- lnst/Common/ResourceCache.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lnst/Common/ResourceCache.py b/lnst/Common/ResourceCache.py index 98558a2dc..421c572e6 100644 --- a/lnst/Common/ResourceCache.py +++ b/lnst/Common/ResourceCache.py @@ -127,7 +127,11 @@ def add_cache_entry(self, entry_hash, filepath, entry_name, entry_type): def del_cache_entry(self, entry_hash): if entry_hash in self._entries: - shutil.rmtree("%s/%s" % (self._root, entry_hash)) + try: + shutil.rmtree("%s/%s" % (self._root, entry_hash)) + except OSError as e: + if e.errno != 2: + raise del self._entries[entry_hash] self._save_index()