Project

Profile

Help

Issue #1563

Content type ID searches not working

Added by paji@redhat.com over 5 years ago. Updated over 2 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Master
Platform Release:
2.8.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

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 }

Related issues

Related to Pulp - Task #1578: Incoming searches should be translated by the modelCLOSED - WONTFIX

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>
Copied to Pulp - Issue #1574: These Content type ID searches not workingCLOSED - CURRENTRELEASE<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision 6c9751fa View on GitHub
Added by semyers over 5 years ago

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

Revision 6c9751fa View on GitHub
Added by semyers over 5 years ago

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

History

#1 Updated by semyers over 5 years ago

  • 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

#2 Updated by semyers over 5 years ago

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)

#3 Updated by semyers over 5 years ago

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.

#4 Updated by paji@redhat.com over 5 years ago

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 }

#5 Updated by semyers over 5 years ago

After removing a pesky backslash from the distribution search, all of those are working on my feature branch. Woot. :)

#6 Updated by semyers over 5 years ago

  • Status changed from ASSIGNED to POST

#7 Updated by semyers over 5 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#8 Updated by paji@redhat.com over 5 years ago

  • Copied to Issue #1574: These Content type ID searches not working added

#9 Updated by amacdona@redhat.com over 5 years ago

  • Related to Task #1578: Incoming searches should be translated by the model added

#10 Updated by dkliban@redhat.com over 5 years ago

  • Status changed from MODIFIED to 5

#11 Updated by dkliban@redhat.com over 5 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE

#12 Updated by bmbouter over 2 years ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF