Merge "Update global progress if no progress was sent"
This commit is contained in:
commit
163e05ee1a
@ -649,14 +649,14 @@ def _update_transaction(transaction, status, progress, message):
|
|||||||
data = {}
|
data = {}
|
||||||
if status:
|
if status:
|
||||||
data['status'] = status
|
data['status'] = status
|
||||||
if progress:
|
|
||||||
data['progress'] = progress
|
|
||||||
if message:
|
if message:
|
||||||
data['message'] = message
|
data['message'] = message
|
||||||
|
data['progress'] = _calculate_progress(transaction, progress)
|
||||||
if data:
|
if data:
|
||||||
objects.Transaction.update(transaction, data)
|
objects.Transaction.update(transaction, data)
|
||||||
|
|
||||||
if transaction.parent and progress:
|
if transaction.parent and data['progress']:
|
||||||
|
logger.debug("Updating parent task: %s.", transaction.parent.uuid)
|
||||||
siblings = transaction.parent.subtasks
|
siblings = transaction.parent.subtasks
|
||||||
total_progress = sum(x.progress for x in siblings)
|
total_progress = sum(x.progress for x in siblings)
|
||||||
objects.Transaction.update(transaction.parent, {
|
objects.Transaction.update(transaction.parent, {
|
||||||
@ -664,6 +664,14 @@ def _update_transaction(transaction, status, progress, message):
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
def _calculate_progress(transaction, progress):
|
||||||
|
if progress is not None:
|
||||||
|
return progress
|
||||||
|
else:
|
||||||
|
return helpers.TaskHelper.recalculate_deployment_task_progress(
|
||||||
|
transaction)
|
||||||
|
|
||||||
|
|
||||||
def _update_cluster_status(transaction):
|
def _update_cluster_status(transaction):
|
||||||
if transaction.dry_run:
|
if transaction.dry_run:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user