Project

Profile

Help

Issue #4191

closed

Pulp does not support all search query strings - only name works reliably

Added by akofink over 5 years ago. Updated almost 4 years ago.

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

Description

Reproduce:
Query Pulp with a query string parameter other than name

Actual:
Pulp ignores most non-name parameters

Expected:
Pulp filters by any parameter

Examples ([httpie syntax](https://httpie.org/doc#querystring-parameters)):
Some of the following are not very useful, but filtering should be consistent.

GET /pulp/api/v3/publishers/file/ type=="foo" # this should always return 0 results

HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 499
Content-Type: application/json
Date: Tue, 27 Nov 2018 13:54:49 GMT
Server: nginx/1.12.2
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "_href": "/pulp/api/v3/publishers/file/1/",
            "created": "2018-11-26T18:21:33.521797Z",
            "distributions": [],
            "last_published": null,
            "last_updated": "2018-11-26T18:21:52.763045Z",
            "manifest": "PULP_MANIFEST",
            "name": "pdf",
            "type": "file"
        },
        {
            "_href": "/pulp/api/v3/publishers/file/2/",
            "created": "2018-11-26T21:16:34.010881Z",
            "distributions": [],
            "last_published": null,
            "last_updated": "2018-11-26T21:16:34.010913Z",
            "manifest": "PULP_MANIFEST",
            "name": "txt",
            "type": "file"
        }
    ]
}
GET /pulp/api/v3/publishers/file/ _href==/pulp/api/v3/publishers/file/1/ # this should always return 1 result

HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 499
Content-Type: application/json
Date: Tue, 27 Nov 2018 14:02:29 GMT
Server: nginx/1.12.2
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "_href": "/pulp/api/v3/publishers/file/1/",
            "created": "2018-11-26T18:21:33.521797Z",
            "distributions": [],
            "last_published": null,
            "last_updated": "2018-11-26T18:21:52.763045Z",
            "manifest": "PULP_MANIFEST",
            "name": "pdf",
            "type": "file"
        },
        {
            "_href": "/pulp/api/v3/publishers/file/2/",
            "created": "2018-11-26T21:16:34.010881Z",
            "distributions": [],
            "last_published": null,
            "last_updated": "2018-11-26T21:16:34.010913Z",
            "manifest": "PULP_MANIFEST",
            "name": "txt",
            "type": "file"
        }
    ]
}
GET /pulp/api/v3/publications/ publisher==/pulp/api/v3/publishers/file/2/

HTTP/1.1 200 OK
Allow: GET, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 590
Content-Type: application/json
Date: Tue, 27 Nov 2018 14:04:30 GMT
Server: nginx/1.12.2
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "_href": "/pulp/api/v3/publications/2/",
            "created": "2018-11-26T18:42:17.866763Z",
            "distributions": [],
            "pass_through": true,
            "publisher": "/pulp/api/v3/publishers/file/1/",
            "repository_version": "/pulp/api/v3/repositories/1/versions/1/"
        },
        {
            "_href": "/pulp/api/v3/publications/1/",
            "created": "2018-11-26T18:32:02.020005Z",
            "distributions": [
                "http://centos7-pulp3-source.virbr0.akofink-desktop/pulp/api/v3/distributions/1/"
            ],
            "pass_through": true,
            "publisher": "/pulp/api/v3/publishers/file/1/",
            "repository_version": "/pulp/api/v3/repositories/1/versions/1/"
        }
    ]
}

There are many more! Try using any of the other non-name parameters in the above API output (i.e. manifest, pass_through, repository_version).

Actions #1

Updated by amacdona@redhat.com over 5 years ago

Filters with Pulp3 are not enabled for all fields. Each filterable field must be explicitly declared, and for the file publisher (which just uses the publisher base class), the only fields that are filterable are `name` and `last_updated`.

If you need other fields to be filterable, please file a story for those fields. Feel free to combine fields into 1 story, but it is probably simplest to file a separate story for each endpoint.

As a note, we did it this way to promote backwards compatibility. It is much easier to add new filters than to move/change filters that already exist.

Actions #2

Updated by CodeHeeler over 5 years ago

  • Status changed from NEW to CLOSED - NOTABUG
Actions #3

Updated by daviddavis almost 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #4

Updated by bmbouter almost 5 years ago

  • Tags deleted (Pulp 3)
Actions #5

Updated by bmbouter almost 4 years ago

  • Category deleted (14)

We are removing the 'API' category per open floor discussion June 16, 2020.

Also available in: Atom PDF