[devtools] fix race when creating backupdir stable
authorJulien Cristau <julien.cristau@logilab.fr>
Fri, 06 Sep 2013 11:01:20 +0200
branchstable
changeset 9235 3eb8d65824f5
parent 9234 ce504d23edf7
child 9236 93c095495e40
[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.
devtools/__init__.py
--- 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):