diff options
authorPedro Alvarez <>2016-01-25 10:31:04 (GMT)
committerBaserock Gerrit <>2016-02-05 15:54:07 (GMT)
commit8698688309aa8ff6e06fc5b060535501711de6c4 (patch)
parentb3ecd02236e58386ac4d7566ef70e751ff0d7e26 (diff)
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 --artifact-cache-server --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
1 files changed, 9 insertions, 2 deletions
diff --git a/morphlib/ b/morphlib/
index f5871d1..75108fc 100644
--- a/morphlib/
+++ b/morphlib/
@@ -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'),
- 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:
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
cliapp.Application.process_args(self, args)