[devtools] fix race when creating backupdir
If somebody else creates backupdir between our stat() and mkdir() (like,
say, another test running in parallel), we shouldn't crash.
--- a/devtools/__init__.py Thu Sep 19 18:11:12 2013 +0200
+++ b/devtools/__init__.py Fri Sep 06 11:01:20 2013 +0200
@@ -288,8 +288,11 @@
The function create it if necessary"""
backupdir = join(self.config.apphome, 'database')
- if not isdir(backupdir):
+ try:
os.makedirs(backupdir)
+ except:
+ if not isdir(backupdir):
+ raise
return backupdir
def config_path(self, db_id):