Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for automatic publishing and distributing #467

Closed
wants to merge 1 commit into from

Conversation

dralley
Copy link
Collaborator

@dralley dralley commented Feb 15, 2021

@pep8speaks
Copy link

pep8speaks commented Feb 15, 2021

Hello @dralley! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-04-02 02:07:49 UTC

@pulp pulp deleted a comment from pulpbot Feb 15, 2021
@daviddavis
Copy link
Contributor

You have a typo--should be closes: #7469.

@dralley dralley force-pushed the auto-publish-distribute branch 4 times, most recently from d598704 to 38bb856 Compare February 15, 2021 22:23
@pulp pulp deleted a comment from pulpbot Feb 15, 2021
@pulpbot
Copy link
Member

pulpbot commented Feb 15, 2021

Attached issue: https://pulp.plan.io/issues/7469

@dralley dralley force-pushed the auto-publish-distribute branch 8 times, most recently from 3fda22e to 022e581 Compare February 16, 2021 03:21
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 16, 2021
@dralley
Copy link
Collaborator Author

dralley commented Feb 16, 2021

test failure is just caused by the requirement of pulpcore 3.11 which doesn't exist yet. and I suppose it doesn't think the prerelease counts

@mdellweg
Copy link
Member

Make it depend on 3.11.dev and it should be fine

@dralley dralley marked this pull request as ready for review February 16, 2021 13:04
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 16, 2021
@@ -99,6 +129,7 @@ class FilePublicationSerializer(PublicationSerializer):
manifest = serializers.CharField(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I remove the fields from the Publication model and proxy them through PublishSettings?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. I lean towards yes (to remove the duplicate data) but I don't have a strong opinion.

dralley added a commit to dralley/pulpcore that referenced this pull request Feb 16, 2021
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 16, 2021
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 16, 2021
@daviddavis daviddavis marked this pull request as draft February 23, 2021 14:47
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 23, 2021
@dralley dralley force-pushed the auto-publish-distribute branch 2 times, most recently from 676334f to d3624b9 Compare February 23, 2021 23:17
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 24, 2021
Abstract models across an API boundary between separate apps is a
nightmare.

Required PR: pulp/pulp_file#467

closes: #7626
https://pulp.plan.io/issues/7626
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 24, 2021
Abstract models across an API boundary between separate apps is a
nightmare.

Required PR: pulp/pulp_file#467

closes: #7626
https://pulp.plan.io/issues/7626
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 24, 2021
Abstract models across an API boundary between separate apps is a
nightmare.

Required PR: pulp/pulp_file#467

closes: #7626
https://pulp.plan.io/issues/7626
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 24, 2021
Abstract models across an API boundary between separate apps is a
nightmare.

Required PR: pulp/pulp_file#467

closes: #7626
https://pulp.plan.io/issues/7626
@dralley dralley force-pushed the auto-publish-distribute branch 2 times, most recently from 570daea to 4c9f374 Compare February 24, 2021 03:06
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 24, 2021
dralley added a commit to dralley/pulpcore that referenced this pull request Feb 24, 2021
Abstract models across an API boundary between separate apps is a
nightmare.

Required PR: pulp/pulp_file#467

closes: #7626
https://pulp.plan.io/issues/7626
@dralley dralley force-pushed the auto-publish-distribute branch 2 times, most recently from bddfeee to 56eaaa9 Compare March 4, 2021 20:33
FilePublishSettings = apps.get_model('file', 'filepublishsettings')

for publication in FilePublication.objects.iterator():
publish_settings, _ = FilePublishSettings.objects.get_or_create(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, this is the recommended way to ignore partial return values. But does it work together with _ binding to gettext?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this particular case, there is no gettext import for it to conflict with, but in the general case, I don't know.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, gettext would make the migrations really unstable.

# Set the core "_publication" field with the value of the detail "publication" field
FileDistribution = apps.get_model('file', 'filedistribution')

distributions = list(FileDistribution.objects.all())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do this in chunks?
I think it would be very bad to get into troubles with memory in the middle of a migration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be really difficult to have enough distributions for that to be a problem (you'd need hundreds of thousands of them) but maybe I can write this better.

]

operations = [
migrations.RunPython(migrate_distribution_fields),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please provide a down migration for this (reverse_code=migrate_distribution_fields_down)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like none of our other migrations provide down migrations, and this one would be particularly difficult since the core tables are involved also.

dralley added a commit to dralley/pulpcore that referenced this pull request Mar 16, 2021
dralley added a commit to dralley/pulpcore that referenced this pull request Mar 16, 2021
dralley added a commit to dralley/pulpcore that referenced this pull request Mar 16, 2021
dralley added a commit to dralley/pulpcore that referenced this pull request Apr 2, 2021
dralley added a commit to dralley/pulpcore that referenced this pull request Apr 2, 2021
dralley added a commit to dralley/pulpcore that referenced this pull request Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants