def set_status(self, status): """ Update action status. If this is a final state, raise corresponding events. """ # Do not raise events if start event was not raised. # Start event is raised when init is set. if self._init: if status == ACT_OK: self._server.action_event(self, 'done') elif status == ACT_ERROR: # Build an error string errors = [] for act in self: if act.status() == ACT_ERROR: errors.append("'%s' failed" % act._command) result = ErrorResult("\n".join(errors)) self._server.action_event(self, 'failed', result) ActionGroup.set_status(self, status)
def set_status(self, status): """ Update action status. If this is a final state, raise corresponding events. """ # Do not raise events if start event was not raised. # Start event is raised when init is set. if self._init: if status == ACT_OK: self._server.action_event(self, 'done') elif status == ACT_ERROR: # Build an error string errors = [] for act in self: if act.status() == ACT_ERROR: errors.append("'%s' failed" % act._command) result = ErrorResult("\n".join(errors)) self._server.action_event(self, 'failed', result) ActionGroup.set_status(self, status)