From 8d443f1ada1453e9d8116f86a6ad45393887de7c Mon Sep 17 00:00:00 2001 From: Simon Westphahl Date: Tue, 14 Feb 2023 11:26:20 +0100 Subject: Fix exception on retry in source base class ERROR zuul.Scheduler: Exception processing pipeline check in tenant foobar Traceback (most recent call last): File "/opt/zuul/lib/python3.10/site-packages/zuul/scheduler.py", line 2149, in process_pipelines refreshed = self._process_pipeline( File "/opt/zuul/lib/python3.10/site-packages/zuul/scheduler.py", line 2241, in _process_pipeline self.process_pipeline_trigger_queue(tenant, pipeline) File "/opt/zuul/lib/python3.10/site-packages/zuul/scheduler.py", line 2447, in process_pipeline_trigger_queue self._process_trigger_event(tenant, pipeline, event) File "/opt/zuul/lib/python3.10/site-packages/zuul/scheduler.py", line 2480, in _process_trigger_event pipeline.manager.addChange(change, event) File "/opt/zuul/lib/python3.10/site-packages/zuul/manager/__init__.py", line 534, in addChange self.updateCommitDependencies(change, None, event) File "/opt/zuul/lib/python3.10/site-packages/zuul/manager/__init__.py", line 864, in updateCommitDependencies dep = source.getChangeByURLWithRetry(match, event) File "/opt/zuul/lib/python3.10/site-packages/zuul/source/__init__.py", line 112, in getChangeByURLWithRetry return dep UnboundLocalError: local variable 'dep' referenced before assignment Change-Id: I1c706e5e5d2d337ec84b8fc1ad5e900191f2362c --- zuul/source/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zuul/source/__init__.py b/zuul/source/__init__.py index 01a683b23..c2487af88 100644 --- a/zuul/source/__init__.py +++ b/zuul/source/__init__.py @@ -97,7 +97,7 @@ class BaseSource(object, metaclass=abc.ABCMeta): # info on subsequent requests we can continue to do the # requested job work. try: - dep = self.getChangeByURL(url, event) + return self.getChangeByURL(url, event) except Exception: # Note that if the change isn't found dep is None. # We do not raise in that case and do not need to handle it @@ -109,7 +109,6 @@ class BaseSource(object, metaclass=abc.ABCMeta): time.sleep(1) else: raise - return dep @abc.abstractmethod def getChangesDependingOn(self, change, projects, tenant): -- cgit v1.2.1