From: Alfredo Deza Date: Wed, 2 Apr 2014 16:53:54 +0000 (-0400) Subject: allow makedir to ignore some errors X-Git-Tag: v1.5.0~16^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F175%2Fhead;p=ceph-deploy.git allow makedir to ignore some errors Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/hosts/remotes.py b/ceph_deploy/hosts/remotes.py index 2c89e8f..33425fe 100644 --- a/ceph_deploy/hosts/remotes.py +++ b/ceph_deploy/hosts/remotes.py @@ -121,8 +121,16 @@ def path_exists(path): return os.path.exists(path) -def makedir(path): - os.makedirs(path) +def makedir(path, ignored=None): + ignored = ignored or [] + try: + os.makedirs(path) + except OSError as error: + if error.errno in ignored: + pass + else: + # re-raise the original exception + raise def unlink(_file):