Project

Profile

Help

Issue #4924

KeyError during migration 0004

Added by quba42 about 1 year ago. Updated about 1 year ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Urgent
Assignee:
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
4. Urgent
Version - Debian:
master
Platform Release:
2.20.0
Target Release - Debian:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:

Description

When there are importers with an empty "config" dict, migration 0004 will throw a KeyError

Applying migration pulp_deb.plugins.migrations.0004_add_distribution failed.

Halting migrations due to a migration failure.
'releases'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pulp/server/db/manage.py", line 279, in main
    return _auto_manage_db(options)
  File "/usr/lib/python2.7/site-packages/pulp/server/db/manage.py", line 346, in _auto_manage_db
    migrate_database(options)
  File "/usr/lib/python2.7/site-packages/pulp/server/db/manage.py", line 175, in migrate_database
    update_current_version=not options.test)
  File "/usr/lib/python2.7/site-packages/pulp/server/db/migrate/models.py", line 206, in apply_migration
    migration.migrate()
  File "/usr/lib/python2.7/site-packages/pulp_deb/plugins/migrations/0004_add_distribution.py", line 74, in migrate
    distributions = repo_importer['config']['releases'].split(',')
KeyError: 'releases'

Related issues

Related to Debian Support - Issue #4138: Handling publish paths correctlyCLOSED - CURRENTRELEASE<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision 99bcc977 View on GitHub
Added by quba42 about 1 year ago

Fix migration 0004 for importers with empty config

This fix prevents KeyErrors during migration 0004. These can happen when there are importers with empty "config" dict.

In addition, the release['suite'] access has now also been guarded. All field access have been double checked to make sure they are sufficiently guarded.

fixes #4924 https://pulp.plan.io/issues/4924

Revision 67832e80 View on GitHub
Added by quba42 6 months ago

Also publish empty repositories

fixes #4924 https://pulp.plan.io/issues/4345

(cherry picked from commit 9f706146408816238cc5e8e6dcdefd5af02b81d6)

History

#1 Updated by quba42 about 1 year ago

The following PR should fix this: https://github.com/pulp/pulp_deb/pull/92

I have also had another look through the migration whether there are any other unguarded accesses to non required db fields (and I did not find any).

#2 Updated by quba42 about 1 year ago

  • Related to Issue #4138: Handling publish paths correctly added

#3 Updated by mdellweg about 1 year ago

  • Priority changed from Normal to Urgent
  • Triaged changed from No to Yes

#4 Updated by quba42 about 1 year ago

  • Status changed from NEW to MODIFIED

#5 Updated by mdellweg about 1 year ago

  • Tags Pulp 2 added

#6 Updated by ttereshc about 1 year ago

  • Platform Release set to 2.20.0

#7 Updated by ttereshc about 1 year ago

  • Sprint/Milestone set to 2.20.0

#8 Updated by ttereshc about 1 year ago

  • Status changed from MODIFIED to 5

#9 Updated by ttereshc about 1 year ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF