Project

Profile

Help

Issue #1929

The 0023_importer_tls_storage.py migration assumes that Importers always have configs when they do not

Added by rbarlow over 4 years ago. Updated over 1 year ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Urgent
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
4. Urgent
Version:
2.8.3
Platform Release:
2.8.4
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix, Pulp 2
Sprint:
Quarter:

Description

Alan Sparks reported on pulp-list that he was unable to apply the upgrade to Pulp 2.8.3 due to an Importer in his database missing a config and the migration assuming the Importers always have configs:

Applying pulp.server.db.migrations version 23                                                                                                                                                                                                 
Applying migration pulp.server.db.migrations.0023_importer_tls_storage failed.                                                                                                                                                                

Halting migrations due to a migration failure.                                                                                                                                                                                                
'config'                                                                                                                                                                                                                                      
Traceback (most recent call last):                                                                                                                                                                                                            
  File "/usr/lib/python2.6/site-packages/pulp/server/db/manage.py", line 193, in main                                                                                                                                                         
    return _auto_manage_db(options)                                                                                                                                                                                                           
  File "/usr/lib/python2.6/site-packages/pulp/server/db/manage.py", line 256, in _auto_manage_db                                                                                                                                              
    migrate_database(options)                                                                                                                                                                                                                 
  File "/usr/lib/python2.6/site-packages/pulp/server/db/manage.py", line 124, in migrate_database                                                                                                                                             
    update_current_version=not options.test)                                                                                                                                                                                                  
  File "/usr/lib/python2.6/site-packages/pulp/server/db/migrate/models.py", line 186, in apply_migration                                                                                                                                      
    migration.migrate()                                                                                                                                                                                                                       
  File "/usr/lib/python2.6/site-packages/pulp/server/db/migrations/0023_importer_tls_storage.py", line 25, in migrate                                                                                                                         
    _write_pem_file(pki_path, importer['config'], key, filename)                                                                                                                                                                              
KeyError: 'config'

We just need to patch the migration to handle the config missing from the Importer. I'm marking this urgent because it's blocking a user from applying a security update.

Thanks to Alan Sparks for the issue report!

Associated revisions

Revision 8487cd5a View on GitHub
Added by rbarlow over 4 years ago

Change migration 23 to not assume that Importers have configs.

https://pulp.plan.io/issues/1929

fixes #1929

Revision 8487cd5a View on GitHub
Added by rbarlow over 4 years ago

Change migration 23 to not assume that Importers have configs.

https://pulp.plan.io/issues/1929

fixes #1929

Revision 48bcea7a View on GitHub
Added by rbarlow over 4 years ago

Change migration 23 to not assume that Importers have configs.

https://pulp.plan.io/issues/1929

fixes #1929

Revision 48bcea7a View on GitHub
Added by rbarlow over 4 years ago

Change migration 23 to not assume that Importers have configs.

https://pulp.plan.io/issues/1929

fixes #1929

History

#1 Updated by semyers over 4 years ago

+1 Urgent/Urgent

#2 Updated by rbarlow over 4 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to rbarlow

#3 Updated by rbarlow over 4 years ago

  • Version set to 2.8.3

#4 Updated by rbarlow over 4 years ago

  • Status changed from ASSIGNED to POST
  • Platform Release set to 2.8.4

#5 Updated by jortel@redhat.com over 4 years ago

  • Triaged changed from No to Yes

#6 Updated by rbarlow over 4 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#7 Updated by kfiresmith over 4 years ago

+1 on this issue. Is it universal?

#8 Updated by kfiresmith over 4 years ago

The fix in Github got me farther onto the migration step 28:

https://paste.fedoraproject.org/370735/64188741/

#9 Updated by bmbouter over 4 years ago

I think a user would only experience the issue if an Importer definition lacks a 'config' field. That could be any user I imagine.

#10 Updated by semyers over 4 years ago

  • Status changed from MODIFIED to 5

#11 Updated by rbarlow over 4 years ago

  • Status changed from 5 to MODIFIED

#12 Updated by semyers over 4 years ago

  • Status changed from MODIFIED to 5

#13 Updated by pthomas@redhat.com over 4 years ago

  • Status changed from 5 to 6

verified
Created a repo through the api
Added an importer without any config
Upgraded pulp to 2.8.4 beta
Ran migration

Migration package pulp.server.db.migrations is up to date at version 23
Migration package pulp_docker.plugins.migrations is up to date at version 2
Migration package pulp_puppet.plugins.migrations is up to date at version 4
Applying pulp_rpm.plugins.migrations version 29
/usr/lib/python2.7/site-packages/pulp_rpm/plugins/migrations/0029_remove_rpm_unused_fields.py:23: DeprecationWarning: update is deprecated. Use replace_one, update_one or update_many instead.
  multi=True

/usr/lib/python2.7/site-packages/pulp_rpm/plugins/migrations/0029_remove_rpm_unused_fields.py:28: DeprecationWarning: update is deprecated. Use replace_one, update_one or update_many instead.
  multi=True

/usr/lib/python2.7/site-packages/mongoengine/document.py:367: DeprecationWarning: update is deprecated. Use replace_one, update_one or update_many instead.
  upsert=upsert, **write_concern)

Migration to pulp_rpm.plugins.migrations version 29 complete.
Applying pulp_rpm.plugins.migrations version 30
/usr/lib/python2.7/site-packages/pulp_rpm/plugins/migrations/0030_remove_errata_unused_fields.py:23: DeprecationWarning: update is deprecated. Use replace_one, update_one or update_many instead.
  multi=True

Migration to pulp_rpm.plugins.migrations version 30 complete.
Loading unit model: docker_blob = pulp_docker.plugins.models:Blob
Loading unit model: docker_manifest = pulp_docker.plugins.models:Manifest
Loading unit model: docker_image = pulp_docker.plugins.models:Image
Loading unit model: docker_tag = pulp_docker.plugins.models:Tag
Loading unit model: puppet_module = pulp_puppet.plugins.db.models:Module
Loading unit model: erratum = pulp_rpm.plugins.db.models:Errata
Loading unit model: distribution = pulp_rpm.plugins.db.models:Distribution
Loading unit model: package_group = pulp_rpm.plugins.db.models:PackageGroup
Loading unit model: package_category = pulp_rpm.plugins.db.models:PackageCategory
Loading unit model: iso = pulp_rpm.plugins.db.models:ISO
Loading unit model: package_environment = pulp_rpm.plugins.db.models:PackageEnvironment
Loading unit model: drpm = pulp_rpm.plugins.db.models:DRPM
Loading unit model: srpm = pulp_rpm.plugins.db.models:SRPM
Loading unit model: rpm = pulp_rpm.plugins.db.models:RPM
Loading unit model: yum_repo_metadata_file = pulp_rpm.plugins.db.models:YumMetadataFile
Database migrations complete.

#14 Updated by semyers over 4 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE

#16 Updated by bmbouter over 1 year ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF