Maintenance: Planio will be observing a scheduled maintenance window this Tuesday, November 5, 2024 from 03:00 UTC until 06:30 UTC to perform urgent network maintenance in our primary data center. Your Planio account will be unavailable during this maintenance window.
Issue #8787
closed"UnboundLocalError: local variable 'result' referenced before assignment" on attempt to sync some repos
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
Updated by ttereshc over 3 years ago
- Triaged changed from No to Yes
- Sprint set to Sprint 97
Updated by dalley over 3 years ago
- Status changed from NEW to POST
- Assignee set to zhunting
Updated by pulpbot over 3 years ago
Updated by dalley over 3 years ago
- Related to Story #8873: pulp 3 stops when encounters 403 error added
Updated by dalley over 3 years ago
- Related to Issue #9019: A variable referenced before assignment while reading repomd added
Updated by dalley over 3 years ago
- Related to deleted (Issue #9019: A variable referenced before assignment while reading repomd )
Updated by dalley over 3 years ago
- Has duplicate Issue #9019: A variable referenced before assignment while reading repomd added
Updated by dalley over 3 years ago
- Has duplicate Issue #9022: errors fetching repomd.xml will fail with python error 'local variable 'result' referenced before assignment' added
Added by dalley over 3 years ago
Updated by dalley over 3 years ago
- Status changed from POST to MODIFIED
Applied in changeset 727b530bbd0e74041c49808b19e1a0333cff2570.
Updated by dalley over 3 years ago
- Copied to Backport #9027: Backport 8787 to 3.13.3 added
Updated by dalley over 3 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
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