Project

Profile

Help

Issue #826

closed

missing criteria field should not return all possible results

Added by amacdona@redhat.com about 9 years ago. Updated about 5 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

There are multiple ways that our use of criteria can have unexpected results, but they all center around the fact that some search results start with all results and filter by the criteria that is passed in. This means that if the criteria is incorrect in some way that everything is returned.

For example, if I pass empty criteria to unassociate, I would expect that none of the content is unassociated. Instead all content (of the repo) is unassociated.

$ pulp-admin -u admin -p admin rpm repo list

    +----------------------------------------------------------------------+
                                RPM Repositories
    +----------------------------------------------------------------------+

    Id:                  zoo1
    Display Name:        zoo1
    Description:         None
    Content Unit Counts:
      Rpm: 32

$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: webpy" -X POST -k -u admin:admin -d '{"criteria":{}}' "https://localhost/pulp/api/v2/repositories/zoo1/actions/unassociate/"

HTTP/1.1 202 Accepted
Date: Wed, 25 Mar 2015 16:03:47 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 172
Content-Type: application/json
    {"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/757a7a4f-23d8-4f9e-a6a8-0ec1efabe149/", "task_id": "757a7a4f-23d8-4f9e-a6a8-0ec1efabe149"}], "result": null, "error": null}

$ pulp-admin -u admin -p admin rpm repo list


    +----------------------------------------------------------------------+
                                RPM Repositories
    +----------------------------------------------------------------------+

    Id:                  zoo1
    Display Name:        zoo1
    Description:         None
    Content Unit Counts:
      Rpm: 0

Similar problems can occur if there are typos in the field names. For instance passing 'distributor_id' instead of 'id'. 'distributor_id' would match nothing,so all distributors would be returned instead of just the ids listed or a 400.

It would be my expectation for the opposite to happen. If I pass bad params, they should either return a 400 or null results. Likewise, passing nothing should either be a validation error or null.

Also available in: Atom PDF