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

Fixing get, update, delete call when non existent importer is provided. #1961

Merged
merged 1 commit into from Jul 9, 2015

Conversation

ipanova
Copy link
Member

@ipanova ipanova commented Jun 30, 2015

closes #750
https://pulp.plan.io/issues/750

All this three calls behave the same:
if a non_exitent_importer provided in the call, but the repo itself exists a 404 missing_resource repo_id will be raised, though the repo exists.
Now with the fix it will return 404 missing_resource importer_id

repo_query_manager = manager_factory.repo_query_manager()
repo = repo_query_manager.find_by_id(repo_id)
if repo is None:
raise pulp_exceptions.MissingResource(repo_id=repo_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

This works here but will fail when merging to master because of my recent mongoengine change. Here is what you will need to do in master (replacing the previous 4 lines):

from pulp.server.db import model

model.Repository.objects.get_repo_or_missing_resource(repo_id)

@pulpbot
Copy link
Member

pulpbot commented Jun 30, 2015

Refer to this link for build results (access rights to CI server needed):
https://pulp-jenkins.rhev-ci-vms.eng.rdu2.redhat.com//job/unittest-pulp-pr/1030/
Test PASSed.

@@ -121,6 +121,35 @@ def _process_repos(repos, details, importers, distributors):
return repos


def _validate_repo_importer_existance(repo_id, importer_id):
Copy link
Contributor

Choose a reason for hiding this comment

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

With a name like this, I do not expect it to return the importer. Perhaps this should be _get_importer or something similar. I think it is reasonable that this function could both retrieve and validate.

@asmacdo
Copy link
Contributor

asmacdo commented Jul 7, 2015

@ipanova, one minor thing, but I think it is ready. The merge forward will be more involved than normal due to some of my recent changes, let me know if I can help.

@pulpbot
Copy link
Member

pulpbot commented Jul 9, 2015

Refer to this link for build results (access rights to CI server needed):
https://pulp-jenkins.rhev-ci-vms.eng.rdu2.redhat.com//job/unittest-pulp-pr/1070/
Test PASSed.

@ipanova ipanova merged commit cb26d89 into pulp:2.7-dev Jul 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
3 participants