Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Convert the distributor manager to mongoengine friendly controller. #2233

Merged
merged 1 commit into from Dec 16, 2015

Conversation

asmacdo
Copy link
Contributor

@asmacdo asmacdo commented Dec 9, 2015

Replaces the old RepoDistributor model and all its uses with new model,
pulp.server.db.model.Distributor. Also replaces all instances of using
pymongo to access the the distributors collection with mongoengine.

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

@@ -169,7 +168,7 @@ def setUp(self):
self.alias = (self.parentfs, self.parentfs)
Consumer.get_collection().remove()
Bind.get_collection().remove()
RepoDistributor.get_collection().remove()
model.Distributor.drop_collection()
Copy link
Contributor

Choose a reason for hiding this comment

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

Does dropping the collection also remove indicies? If so, then sticking with a remove call would be better.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe dropping the collection does remove the indices as well.

@mhrivnak mhrivnak self-assigned this Dec 9, 2015
"""
try:
distributor_manager = manager_factory.repo_distributor_manager()
distributor_manager.set_distributor_scratchpad(self.repo_id, self.distributor_id, value)
qs = model.Distributor.objects.get_or_404
Copy link
Contributor

Choose a reason for hiding this comment

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

It's worth noting that the except statement below will catch the MissingResource exception and turn it into whatever a DistributorConduitException is. :( You've preserved previous behavior, which is totally fine, but I thought I'd at least point it out that the result of calling get_or_404 is being diminished.

@mhrivnak mhrivnak added the LGTM label Dec 10, 2015
@mhrivnak mhrivnak assigned asmacdo and unassigned mhrivnak Dec 10, 2015
@asmacdo
Copy link
Contributor Author

asmacdo commented Dec 10, 2015

@mhrivnak thanks for the super fast review!

@asmacdo
Copy link
Contributor Author

asmacdo commented Dec 11, 2015

ok test

Replaces the old RepoDistributor model and all its uses with new model,
pulp.server.db.model.Distributor. Also replaces all instances of using
pymongo to access the the distributors collection with mongoengine.

closes pulp#780
asmacdo added a commit that referenced this pull request Dec 16, 2015
Convert the distributor manager to mongoengine friendly controller.
@asmacdo asmacdo merged commit 6ced710 into pulp:master Dec 16, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants