Change variable used by log message
The code was changing the status of a task and then logging an info message about the change using the already-changed variable. This patch saves the old status before the task status is modified so that the status transition can be accurately reported in the log. Change-Id: I84fef1d710f24f601971a348f53d74b6a6d6a2f9 Closes-bug: #1713740
This commit is contained in:
parent
02cd5cba70
commit
e1321298e7
@ -403,12 +403,12 @@ class Task(object):
|
||||
|
||||
def _set_task_status(self, new_status):
|
||||
if self._validate_task_status_transition(self.status, new_status):
|
||||
old_status = self.status
|
||||
self._status = new_status
|
||||
LOG.info(_LI("Task [%(task_id)s] status changing from "
|
||||
"%(cur_status)s to %(new_status)s"),
|
||||
{'task_id': self.task_id, 'cur_status': self.status,
|
||||
{'task_id': self.task_id, 'cur_status': old_status,
|
||||
'new_status': new_status})
|
||||
self._status = new_status
|
||||
else:
|
||||
LOG.error(_LE("Task [%(task_id)s] status failed to change from "
|
||||
"%(cur_status)s to %(new_status)s"),
|
||||
|
Loading…
Reference in New Issue
Block a user