Actions
Issue #8787
closed"UnboundLocalError: local variable 'result' referenced before assignment" on attempt to sync some repos
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Master
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 100
Quarter:
Description
Today I was trying to sync some Red Hat repos with fresh pulp-rpm 3.12.0 release. Everything went well, except for couple of repos that generated this stack trace in the logs:
May 20 11:20:17 pulp3.skracic.net rq[1495551]: pulp [612c4427c121435c9fea0b933098c1cd]: pulp_rpm.app.tasks.synchronizing:INFO: Synchronizing: repository=rhel-8
-for-aarch64-appstream-beta-source-rhui-rpms remote=rhel-8-for-aarch64-appstream-beta-source-rhui-rpms
May 20 11:20:17 pulp3.skracic.net rq[1495559]: pulp [9e8d4c3e69de43b58bb023182fe0db84]: rq.worker:ERROR: Traceback (most recent call last):
May 20 11:20:17 pulp3.skracic.net rq[1495559]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py", line 1013, in perform_job
May 20 11:20:17 pulp3.skracic.net rq[1495559]: rv = job.perform()
May 20 11:20:17 pulp3.skracic.net rq[1495559]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 709, in perform
May 20 11:20:17 pulp3.skracic.net rq[1495559]: self._result = self._execute()
May 20 11:20:17 pulp3.skracic.net rq[1495559]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 732, in _execute
May 20 11:20:17 pulp3.skracic.net rq[1495559]: result = self.func(*self.args, **self.kwargs)
May 20 11:20:17 pulp3.skracic.net rq[1495559]: File "/usr/local/lib/pulp/src/pulp-rpm/pulp_rpm/app/tasks/synchronizing.py", line 227, in synchronize
May 20 11:20:17 pulp3.skracic.net rq[1495559]: remote_url = fetch_remote_url(remote)
May 20 11:20:17 pulp3.skracic.net rq[1495559]: File "/usr/local/lib/pulp/src/pulp-rpm/pulp_rpm/app/tasks/synchronizing.py", line 141, in fetch_remote_url
May 20 11:20:17 pulp3.skracic.net rq[1495559]: if get_repomd_file(remote, remote_url):
May 20 11:20:17 pulp3.skracic.net rq[1495559]: File "/usr/local/lib/pulp/src/pulp-rpm/pulp_rpm/app/tasks/synchronizing.py", line 110, in get_repomd_file
May 20 11:20:17 pulp3.skracic.net rq[1495559]: return result
May 20 11:20:17 pulp3.skracic.net rq[1495559]: UnboundLocalError: local variable 'result' referenced before assignment
Upon further inspection, it looks like the repos themselves have been "turned off" following the RHEL 8.4 GA, and when tried to download using the command line utilities, 403 Forbidden error code is retrieved.
So it looks like the exception handling should deal with 403 returned from the remote URL.
My Pulp installation is running on RHEL 8, BTW.
Related issues
Actions
Fix unbound local error when Pulp receives a non-404 ClientResponseError
If Pulp receives a ClientResponseError when attempting to download a file, but the status code isn't 404, then we go down the wrong code path.
closes: #8787 https://pulp.plan.io/issues/8787