summaryrefslogtreecommitdiff
path: root/taskflow/utils/persistence_utils.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-10-14 18:40:55 +0000
committerGerrit Code Review <review@openstack.org>2013-10-14 18:40:55 +0000
commitbae0f506b9f19c89a5ecb66262596e43b7178d05 (patch)
tree38d8488c60335f1a3d9e6df0739e3fe947da88c1 /taskflow/utils/persistence_utils.py
parentc38fbac0001e72ec9dc37f84a554f9973f7714bc (diff)
parent28556fd572668a4edf2f28f3a3dc3a213e45eef3 (diff)
downloadtaskflow-bae0f506b9f19c89a5ecb66262596e43b7178d05.tar.gz
Merge "Create logbook if not provided for create_flow_details"
Diffstat (limited to 'taskflow/utils/persistence_utils.py')
-rw-r--r--taskflow/utils/persistence_utils.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/taskflow/utils/persistence_utils.py b/taskflow/utils/persistence_utils.py
index 846c5af..2792cd1 100644
--- a/taskflow/utils/persistence_utils.py
+++ b/taskflow/utils/persistence_utils.py
@@ -75,6 +75,11 @@ def create_flow_detail(flow, book=None, backend=None):
LOG.warn("Flow %s does not have a uuid attribute, creating one.", flow)
flow_id = uuidutils.generate_uuid()
flow_detail = logbook.FlowDetail(name=flow_name, uuid=flow_id)
+
+ if backend is not None and book is None:
+ LOG.warn("No logbook provided for flow %s, creating one.", flow)
+ book = temporary_log_book(backend)
+
if book is not None:
book.add(flow_detail)
if backend is not None:
@@ -84,8 +89,6 @@ def create_flow_detail(flow, book=None, backend=None):
# that the freshest version is given back
return book.find(flow_id)
else:
- if backend is not None:
- LOG.warn("Can not save %s without a provided logbook", flow)
return flow_detail