From 68fe32580ea4f7058bb15821566fa8ff10876ec5 Mon Sep 17 00:00:00 2001 From: gongysh Date: Wed, 21 Nov 2012 12:11:11 +0800 Subject: raise_on_error parameter shouldn't be passed to task function Modify the run_periodic_tasks() so that It has known parameters. Task function has the only parameter 'context' Bug #1081428 Change-Id: Ibc3da521df3dc47f8c136ade1070112fd5ea1039 --- openstack/common/periodic_task.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'openstack/common') diff --git a/openstack/common/periodic_task.py b/openstack/common/periodic_task.py index edfee9b..8a32162 100644 --- a/openstack/common/periodic_task.py +++ b/openstack/common/periodic_task.py @@ -87,9 +87,8 @@ class _PeriodicTasksMeta(type): class PeriodicTasks(object): __metaclass__ = _PeriodicTasksMeta - def run_periodic_tasks(self, *args, **kwargs): + def run_periodic_tasks(self, context, raise_on_error=False): """Tasks to be run at a periodic interval.""" - raise_on_error = kwargs.get('raise_on_error', False) for task_name, task in self._periodic_tasks: full_task_name = '.'.join([self.__class__.__name__, task_name]) @@ -104,7 +103,7 @@ class PeriodicTasks(object): LOG.debug(_("Running periodic task %(full_task_name)s"), locals()) try: - task(self, *args, **kwargs) + task(self, context) except Exception as e: if raise_on_error: raise -- cgit