commit db783321cc46f5733815e638975c48a1c63c0d25 Author: Zane Bitter Date: Mon Sep 21 09:34:44 2020 -0400 Fix race condition initialising persistent dict Change-Id: I6cf13913749e3773e12d9e3c316b166652468edc Story: 2008166 Task: 40916 diff --git a/sushy_tools/emulator/memoize.py b/sushy_tools/emulator/memoize.py index 88158a3..aaadd7b 100644 --- a/sushy_tools/emulator/memoize.py +++ b/sushy_tools/emulator/memoize.py @@ -78,8 +78,7 @@ class PersistentDict(MutableMapping): def make_permanent(self, dbpath, dbfile): dbpath = dbpath or self.DBPATH - if not os.path.exists(dbpath): - os.makedirs(dbpath) + os.makedirs(dbpath, exist_ok=True) self._dbpath = os.path.join(dbpath, dbfile) + '.sqlite'