Use method ensure_tree from oslo.utils

Oslo.utils provides same function and just use it.

Change-Id: Iac245d4d98c41edea5294a4d8842db69a42b3794
This commit is contained in:
ChangBo Guo(gcb)
2016-09-25 10:22:00 +08:00
parent e8b1d58091
commit e34bd5f5d9
2 changed files with 2 additions and 20 deletions

View File

@@ -24,6 +24,7 @@ import shutil
import cachetools
import fasteners
from oslo_serialization import jsonutils
from oslo_utils import fileutils
from taskflow import exceptions as exc
from taskflow.persistence import path_based
@@ -146,7 +147,7 @@ class Connection(path_based.PathBasedConnection):
def _ensure_path(self, path):
with _storagefailure_wrapper():
misc.ensure_tree(path)
fileutils.ensure_tree(path)
def _create_link(self, src_path, dest_path, transaction):
with _storagefailure_wrapper():

View File

@@ -18,7 +18,6 @@
import collections
import contextlib
import datetime
import errno
import inspect
import os
import re
@@ -467,24 +466,6 @@ def as_int(obj, quiet=False):
return obj
# Taken from oslo-incubator file-utils but since that module pulls in a large
# amount of other files it does not seem so useful to include that full
# module just for this function.
def ensure_tree(path):
"""Create a directory (and any ancestor directories required).
:param path: Directory to create
"""
try:
os.makedirs(path)
except OSError as e:
if e.errno == errno.EEXIST:
if not os.path.isdir(path):
raise
else:
raise
@contextlib.contextmanager
def capture_failure():
"""Captures the occurring exception and provides a failure object back.