Project

Profile

Help

Task #8386

closed

Story #8383: [EPIC] As a plugin writer I have the `repository`, `publication`, and `repository_version` fields on Distribution MasterModel

Remove `BaseDistribution` and associated objects from Pulp and the plugin API

Added by bmbouter over 3 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 97
Quarter:

Description

These were deprecated with 3.12.

Things to do

  1. Remove BaseDistribution, BaseDistributionViewset, BaseDistributionSerializer and DistributionFilter entirely from the code and the plugin API.
  2. Delete the BasePathOverlapMixin object and move its code into the DistributionSerializer.
  3. Update the DistributionSerializer.validate_base_path to only consider the Distribution model and not the BaseDistribution model.
  4. Update the DistributionSerializer.name validator to disinclude BaseDistribution
  5. Update the Content app's Handler._match_distribution to only match on Distribution and disinclude BaseDistribution.
Actions #1

Updated by bmbouter over 3 years ago

  • Subject changed from Remove `BaseDistribution`, `BaseDistributionViewset`, and `BaseDistributionSerializer` from plugin API to Remove `BaseDistribution` and associated objects from Pulp and the plugin API
  • Description updated (diff)
Actions #2

Updated by bmbouter over 3 years ago

  • Description updated (diff)
Actions #3

Updated by daviddavis over 3 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to daviddavis
Actions #4

Updated by daviddavis over 3 years ago

  • Sprint set to Sprint 95
Actions #5

Updated by daviddavis over 3 years ago

  • Status changed from ASSIGNED to NEW
  • Assignee deleted (daviddavis)

I looked into this and there's a problem. Removing the BaseDistribution model forces us to create the migration that cleans up the base distribution table.

However, this migration causes all previous migrations that touch the base distribution table in anyway to fail:

django.db.migrations.exceptions.InvalidBasesError: Cannot resolve bases for [<ModelState: 'file.FileDistribution'>, <ModelState: 'rpm.RpmDistribution'>]                                     

This is pretty much any migration involving distributions and it includes the migrations we created to move the data from the base distribution table to the distribution table. We can use run_before to solve this problem but there are two things to consider.

First, we've already released plugins that are compatible with pulpcore 3.13. So we'd have to postpone removing BaseDistribution until at least 3.14. We could still remove BaseDistribution stuff from the plugin API though in 3.13.

Second, let's say we ship the base distribution removal migration in 3.14. In order to support 3.14, plugins will declare their that migrations run_before this new migration but doing so will mean that these plugins won't work against 3.13 as run_before checks for the migration, and this new migration won't be in 3.13 (see previous paragraph).

What we could do is either:

  1. Create a no-op migration in 3.13 that plugin migrations could pin to via run_before
  2. Use an arbitrary migration that proceeds the base distribution removal migration (e.g. 0063_repository_retained_versions)

Thoughts?

Actions #6

Updated by rchan over 3 years ago

  • Sprint changed from Sprint 95 to Sprint 96
Actions #7

Updated by daviddavis over 3 years ago

On the master branches for pulpcore and pulp_file, I went into the pulp_file migration 0009_move_data_to_new_master_distribution_model.py and added this line:

run_before = [('core', '0063_repository_retained_versions')]

Having both pulpcore and pulp_file installed, I ran pclean and confirmed that pulp_file 0009 proceeded pulpcore 0063:

  Applying core.0062_add_new_distribution_mastermodel... OK
  Applying file.0009_move_data_to_new_master_distribution_model... OK
  Applying core.0063_repository_retained_versions... OK
  Applying file.0010_auto_publish... OK

Then I uninstalled pulp_file, ran pclean, reinstalled pulp_file, and finally ran migrate:

django.db.migrations.exceptions.InconsistentMigrationHistory: Migration core.0063_repository_retained_versions is applied before its dependency file.0009_move_data_to_new_master_distribution_model on database 'default'.

So dalley was correct.

Actions #8

Updated by daviddavis over 3 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to daviddavis
Actions #9

Updated by pulpbot over 3 years ago

  • Status changed from ASSIGNED to POST
Actions #10

Updated by daviddavis over 3 years ago

  • Sprint/Milestone changed from 3.13.0 to 3.14.0

Today at pulpcore, we agreed to target 3.14 with this work.

Actions #11

Updated by daviddavis over 3 years ago

  • Sprint/Milestone changed from 3.14.0 to 3.13.0

Adding back to 3.13 to discuss at next go/no-go meeting.

Actions #12

Updated by rchan over 3 years ago

  • Sprint changed from Sprint 96 to Sprint 97
Actions #13

Updated by daviddavis over 3 years ago

  • Sprint/Milestone changed from 3.13.0 to 3.14.0

Added by daviddavis over 3 years ago

Revision aed355fb | View on GitHub

Remove BaseDistribution and associated objects

fixes #8386

Actions #14

Updated by daviddavis over 3 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #15

Updated by daviddavis over 3 years ago

  • Sprint/Milestone changed from 3.14.0 to 3.13.0
Actions #16

Updated by pulpbot over 3 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF