summaryrefslogtreecommitdiff
path: root/taskflow
diff options
context:
space:
mode:
authorChangBo Guo(gcb) <eric.guo@easystack.cn>2016-09-25 10:22:00 +0800
committerChangBo Guo(gcb) <eric.guo@easystack.cn>2016-09-25 10:53:52 +0800
commite34bd5f5d9c60ce49c6e249ebe2e29c8cfbbbb01 (patch)
treef2c200b34e2533c92353e0b099f041da0e977dc8 /taskflow
parente8b1d580912a228d990e496663ddb16ce10db724 (diff)
downloadtaskflow-e34bd5f5d9c60ce49c6e249ebe2e29c8cfbbbb01.tar.gz
Use method ensure_tree from oslo.utils
Oslo.utils provides same function and just use it. Change-Id: Iac245d4d98c41edea5294a4d8842db69a42b3794
Diffstat (limited to 'taskflow')
-rw-r--r--taskflow/persistence/backends/impl_dir.py3
-rw-r--r--taskflow/utils/misc.py19
2 files changed, 2 insertions, 20 deletions
diff --git a/taskflow/persistence/backends/impl_dir.py b/taskflow/persistence/backends/impl_dir.py
index 9d7b3ca..85f1f74 100644
--- a/taskflow/persistence/backends/impl_dir.py
+++ b/taskflow/persistence/backends/impl_dir.py
@@ -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():
diff --git a/taskflow/utils/misc.py b/taskflow/utils/misc.py
index ef121df..421449d 100644
--- a/taskflow/utils/misc.py
+++ b/taskflow/utils/misc.py
@@ -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.