Issue #1563
closed
Content type ID searches not working
Status:
CLOSED - CURRENTRELEASE
Description
1) Get the zoo5 repo from -> https://github.com/Katello/runcible/tree/master/test/fixtures/repositories/zoo5 (we just need the repo.) Steps below will assume file:///var/www/repositories/zoo5 is the destination
2)
$ pulp-admin rpm repo create --repo-id=ideate --feed=file:///var/www/repositories/zoo5
$ pulp-admin rpm repo sync run --repo-id=ideate
3) These urls are all returning blank responses. They should return content instead.
POST request to /pulp/api/v2/content/units/erratum/search/ with params {"criteria": {"filters": {"unit": {"id": {"$in": ["RHEA-2010:0002"]}}}}}, "include_repos": true }
POST request to /pulp/api/v2/content/units/package_category/search/ with params {"criteria": {"filters": {"unit": {"id": {"$in": ["all"]}}}}}, "include_repos": true }
POST request to /pulp/api/v2/content/units/package_group/search/ with params {"criteria": {"filters": {"unit": {"id": {"$in": ["bird"]}}}}}, "include_repos": true }
POST request to /pulp/api/v2/content/units/distribution/search/ with params {"criteria": {"filters": {"unit": {"id": {"$in": ["ks-Test Family-TestVariant-16-x86_64\"]}}}}}, "include_repos": true }
- Status changed from NEW to ASSIGNED
- Assignee set to semyers
- Priority changed from Normal to High
- Platform Release set to 2.8.0
- Triaged changed from No to Yes
'nother blocker dealing with searching mongo without talking to the model serializers first
There is a serialization issue related to others (like #1527 & #1535), but I think there's also a client-side issue. Including the 'unit' field in 'filters' makes this look like a unit association criteria, but search views are expecting search criteria.
See https://pulp.readthedocs.org/en/2.7-release/dev-guide/integration/rest-api/content/units.html and https://pulp.readthedocs.org/en/2.7-release/dev-guide/conventions/criteria.html for more detail. If these queries were working in 2.7, I don't know that they were supposed to; the documented API for 2.7 doesn't support unit association criteria in search views generally, and the content unit search views at pulp/api/v2/content/units/<content_type>/search/ are documented as accepting search criteria.
So, after my serialization fix makes it to 2.8 (PR coming soon, I plan to clean up https://github.com/pulp/pulp/pull/2343 and put it in there since it's a related two-line fix), the request criteria should be more like
{
"criteria": {
"filters": {
"id": {
"$in": [
"RHEA-2010:0001"
]
}
}
},
"include_repos": true
}
instead of
{
"criteria": {
"filters": {
"unit": {
"id": {
"$in": [
"RHEA-2010:0001"
]
}
}
}
},
"include_repos": true
}
(remove the 'unit' level)
I haven't checked (yet) to see if those criteria are coming out of pulp-admin. I'm going to have a pretty good laugh if they are.
Sorry about this but in my effort to clean up the json I put the wrong params in the first description. Correct ones are below matching your updates.
For errata it is
POST request to /pulp/api/v2/content/units/erratum/search/ with params {"criteria": {"filters": {"id": {"$in": ["RHEA-2010:0002"]}}}}, "include_repos": true }
For package categories
POST request to /pulp/api/v2/content/units/package_category/search/ with params {"criteria": {"filters": {"id": {"$in": ["all"]}}}}, "include_repos": true }
For package groups
POST request to /pulp/api/v2/content/units/package_group/search/ with params {"criteria": {"filters": {"id": {"$in": ["bird"]}}}}, "include_repos": true }
For Distributions
POST request to /pulp/api/v2/content/units/distribution/search/ with params {"criteria": {"filters": {"id": {"$in": ["ks-Test Family-TestVariant-16-x86_64\"]}}}}, "include_repos": true }
After removing a pesky backslash from the distribution search, all of those are working on my feature branch. Woot. :)
- Status changed from ASSIGNED to POST
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
- Copied to Issue #1574: These Content type ID searches not working added
- Related to Task #1578: Incoming searches should be translated by the model added
- Status changed from MODIFIED to 5
- Status changed from 5 to CLOSED - CURRENTRELEASE
Also available in: Atom
PDF
Use model serializers when searching mongoengine content units
When breaking a criteria down into its raw mongo queries, use the model serializers for a given content type to adjust the unit search spec as-needed for each content type in the criteria.
https://pulp.plan.io/issues/1479 fixes #1479
https://pulp.plan.io/issues/1533 fixes #1533
https://pulp.plan.io/issues/1535 fixes #1535
https://pulp.plan.io/issues/1563 fixes #1563