This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix marking of distributors #159
Fix marking of distributors #159
Changes from all commits
3f66e4f32f9ce8File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it enough to mark distributors as
is_migrated=Falseand not save their pk for removal?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
distributions that have been affected indirectly ( aka they lost their publication only) it is enough just to flip the is_migrated flag to False so then the distribution will be updated with the new publication.
distributions that have been affected directly( aka repos were recreated in pulp2), will be removed , because the corresponding pulp2distributor will be present in this
pulp2distributors_with_old_distributions_qThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting that the affected ones are updated later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is hit where we take into consideration distributors that are in plan and is_mifrated=False https://github.com/pulp/pulp-2to3-migration/blob/master/pulp_2to3_migration/app/migration.py#L224
then we are trying to migrate that distributor https://github.com/pulp/pulp-2to3-migration/blob/master/pulp_2to3_migration/app/migration.py#L331
and here we are 1) taking already created publication from the repo and 2) update the existing distribution https://github.com/pulp/pulp-2to3-migration/blob/master/pulp_2to3_migration/app/plugin/iso/repository.py#L76 that's why it is unnecessary to remove it in the remove_old_resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The missing part for me was that we take care of publication update in every plugin which has publications. And also publication ends up as a part of
base_config, it was unexpected I missed that.So I'm torn now. Let me know what you think.
My concern is that plugin writer needs to know that they are responsible for the update case (when publication changed) and not only for a create one. So we can either add some docs to the plugin writer's guide about that. Or we can remove distributors here and they will only worry about creation.
I'm fine with both, not so many plgin writers will need to extend the migration plugin. Just the problem is painful if the implementation of update case is missed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we keep publication or repo_version( depending on the plugin) among base_config data then it will be handled in obth cases, whether it is a create or update or the object.
If we remove the distribution but this line is missing https://github.com/pulp/pulp-2to3-migration/blob/master/pulp_2to3_migration/app/plugin/iso/repository.py#L75 it does not really matter whether we remove the distribution or just flip the flag in pulp2dist to later update the distribution, in both cases distribution object will miss the publication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tldr the problem is not in the update or creation of the object but to make sure we include the relation between the publication and distribution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to document that it is important to use update_or_create in distributions/remotes