summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2016-01-25 10:31:04 (GMT)
committerBaserock Gerrit <gerrit@baserock.org>2016-02-05 15:54:07 (GMT)
commit8698688309aa8ff6e06fc5b060535501711de6c4 (patch)
treecd9869b235bea93b3f8ff4522924bb1257fe7925
parentb3ecd02236e58386ac4d7566ef70e751ff0d7e26 (diff)
downloadmorph-8698688309aa8ff6e06fc5b060535501711de6c4.tar.gz
More robust creation of tempdirs
This commit addresses the same issue that we tried to solve in fa431c3ce38204f5237337fd2045ad6269413258 but this time with temp dirs: + echo INFO: Mason building: master at fe64c00f17a4922c7499f9bc48f672cca293fc65 INFO: Mason building: master at fe64c00f17a4922c7499f9bc48f672cca293fc65 + scripts/release-build --no-default-configs --trove-host 192.168.222.58 --artifact-cache-server http://192.168.222.14:8080/ --controllers x86_64:mason-x86-64 clusters/ci.morph ERROR: /srv/distbuild/tmp/chunks: File exists ERROR: /srv/distbuild/tmp/chunks: File exists This has been happening in Mason since we remove every folder used by Morph after Mason finishes. Change-Id: I5a5bfd3c01b6fd0da4b913c5bb8eac77a3233d1e
-rw-r--r--morphlib/app.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index f5871d1..75108fc 100644
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2015 Codethink Limited
+# Copyright (C) 2011-2016 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,6 +14,7 @@
import cliapp
+import errno
import logging
import os
import pipes
@@ -286,8 +287,14 @@ class Morph(cliapp.Application):
os.path.join(tmpdir, 'staging'),
os.path.join(tmpdir, 'deployments'),
self.settings['cachedir']):
- if not os.path.exists(required_dir):
+ # Don't check the folder exists and handle the exception that
+ # happens in this case to avoid errors if the folder is created
+ # by something else just after the check.
+ try:
os.makedirs(required_dir)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
cliapp.Application.process_args(self, args)