Actions
Issue #6640
closedMigrating with custom name raises UnboundLocalError: local variable 'pulp2repo' referenced before assignment
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 75
Quarter:
Description
It happens if I specify a name for a repo different from a pulp 2 one. E.g. I'd like to migrate rpm_unsigned.
{
"plugins": [
{
"type": "rpm",
"repositories": [
{
"name": "random_name",
"repository_versions": [
{
"pulp2_repository_id": "rpm_unsigned",
"pulp2_distributor_repository_ids": [
"rpm_unsigned"
]
}
],
"pulp2_importer_repository_id": "rpm_unsigned"
}
]
}
]
}
: pulp: rq.worker:ERROR: UnboundLocalError: local variable 'pulp2repo' referenced before assignment
: Traceback (most recent call last):
: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py", line 886, in perform_job
: rv = job.perform()
: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 664, in perform
: self._result = self._execute()
: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 670, in _execute
: return self.func(*self.args, **self.kwargs)
: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/tasks/migrate.py", line 122, in migrate_from_pulp2
: migrate_repositories(plan)
: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/migration.py", line 99, in migrate_repositories
: pulp2repo.pulp3_repository = repo
: UnboundLocalError: local variable 'pulp2repo' referenced before assignment
Actions
Set pulp3_repo relation for all the cases, including remigration.
As a side effect, also fixes the case when a repo name differs from the pulp2 one.
closes #6964 https://pulp.plan.io/issues/6964
closes #6640 https://pulp.plan.io/issues/6640
closes #6966 https://pulp.plan.io/issues/6966