summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-06-21 01:56:00 +0000
committerGerrit Code Review <review@openstack.org>2015-06-21 01:56:00 +0000
commit68f3fd04c6c6d97863c22ae8f5b2630b3d2d4f80 (patch)
tree391fd8804c08d4bee85f1c96d70fa63f08d53f3f
parent45fb84278ffff57c92c18953c535a98672eb7b7a (diff)
parentad296327136015b03f5e3d95234e79972f99d9f7 (diff)
downloadtaskflow-68f3fd04c6c6d97863c22ae8f5b2630b3d2d4f80.tar.gz
Merge "Use a class constant for the default path based backend path"
-rw-r--r--taskflow/persistence/backends/impl_memory.py6
-rw-r--r--taskflow/persistence/backends/impl_zookeeper.py6
-rw-r--r--taskflow/persistence/path_based.py5
3 files changed, 13 insertions, 4 deletions
diff --git a/taskflow/persistence/backends/impl_memory.py b/taskflow/persistence/backends/impl_memory.py
index 22a0652..37a67d0 100644
--- a/taskflow/persistence/backends/impl_memory.py
+++ b/taskflow/persistence/backends/impl_memory.py
@@ -308,10 +308,12 @@ class MemoryBackend(path_based.PathBasedBackend):
guarantee that there will be no inter-thread race conditions when
writing and reading by using a read/write locks.
"""
+
+ #: Default path used when none is provided.
+ DEFAULT_PATH = pp.sep
+
def __init__(self, conf=None):
super(MemoryBackend, self).__init__(conf)
- if self._path is None:
- self._path = pp.sep
self.memory = FakeFilesystem(deep_copy=self._conf.get('deep_copy',
True))
self.lock = fasteners.ReaderWriterLock()
diff --git a/taskflow/persistence/backends/impl_zookeeper.py b/taskflow/persistence/backends/impl_zookeeper.py
index 279e0c6..687f103 100644
--- a/taskflow/persistence/backends/impl_zookeeper.py
+++ b/taskflow/persistence/backends/impl_zookeeper.py
@@ -40,10 +40,12 @@ class ZkBackend(path_based.PathBasedBackend):
"path": "/taskflow",
}
"""
+
+ #: Default path used when none is provided.
+ DEFAULT_PATH = '/taskflow'
+
def __init__(self, conf, client=None):
super(ZkBackend, self).__init__(conf)
- if not self._path:
- self._path = '/taskflow'
if not paths.isabs(self._path):
raise ValueError("Zookeeper path must be absolute")
if client is not None:
diff --git a/taskflow/persistence/path_based.py b/taskflow/persistence/path_based.py
index 6c065df..0d72997 100644
--- a/taskflow/persistence/path_based.py
+++ b/taskflow/persistence/path_based.py
@@ -34,9 +34,14 @@ class PathBasedBackend(base.Backend):
the contents of those objects for later reading and writing.
"""
+ #: Default path used when none is provided.
+ DEFAULT_PATH = None
+
def __init__(self, conf):
super(PathBasedBackend, self).__init__(conf)
self._path = self._conf.get('path', None)
+ if not self._path:
+ self._path = self.DEFAULT_PATH
@property
def path(self):