Merge "Update global progress if no progress was sent"

This commit is contained in:
Jenkins 2016-12-23 13:58:43 +00:00 committed by Gerrit Code Review
commit 163e05ee1a
1 changed files with 11 additions and 3 deletions

View File

@ -649,14 +649,14 @@ def _update_transaction(transaction, status, progress, message):
data = {}
if status:
data['status'] = status
if progress:
data['progress'] = progress
if message:
data['message'] = message
data['progress'] = _calculate_progress(transaction, progress)
if 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
total_progress = sum(x.progress for x in siblings)
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):
if transaction.dry_run:
return