Project

Profile

Help

Story #237

the "Criteria" object just accepts anything the user gives it

Added by igulina@redhat.com almost 7 years ago. Updated over 2 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

++ This bug was initially created as a clone of Bugzilla Bug #1111570 ++

Description of problem:

Description of problem:
It's possible to regenerate applicability data for a nonexisting repo. It returns 200 OK and spawned task reports successful state.

Version-Release number of selected component (if applicable):

rpm -qa pulp-server

pulp-server-2.4.0-0.20.beta.el6.noarch

How reproducible:
always

Steps to Reproduce:

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

--------------------------------------------------------------------
RPM Repositories
--------------------------------------------------------------------

Id: gena
Display Name: gena
Description: None
Content Unit Counts:
Rpm: 3

pulp-admin -u admin -p admin rpm repo uploads rpm --repo-id gena --file=dog-4.23-1.noarch.rpm

--------------------------------------------------------------------
Unit Upload
--------------------------------------------------------------------

Extracting necessary metadata for each request...
[==================================================] 100%
Analyzing: dog-4.23-1.noarch.rpm
... completed

Creating upload requests on the server...
[==================================================] 100%
Initializing: dog-4.23-1.noarch.rpm
... completed

Starting upload of selected units. If this process is stopped through ctrl+c,
the uploads will be paused and may be resumed later using the resume command or
cancelled entirely using the cancel command.

Uploading: dog-4.23-1.noarch.rpm
[==================================================] 100%
2423/2423 bytes
... completed

Importing into the repository...
This command may be exited via ctrl+c without affecting the request.

[\]
Running...

Task Succeeded

Deleting the upload request...
... completed

curl -i -H "Accept: application/json" -X POST -k -u admin:admin -d '{ "repo_criteria": { "filters": {"id": {"$in": ["cheburahska"]}}}}' 'https://localhost/pulp/api/v2/repositories/actions/content/regenerate_applicability/'

HTTP/1.1 202 Accepted
Date: Fri, 20 Jun 2014 11:08:02 GMT
Server: Apache/2.2.15 (Red Hat)
Content-Encoding: utf-8
Content-Length: 172
Connection: close
Content-Type: application/json

{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/b75c6b4d-8725-4808-b1da-91b35b2281a4/", "task_id": "b75c6b4d-8725-4808-b1da-91b35b2281a4"}], "result": null, "error": null}

pulp-admin -u admin -p admin tasks details --task-id="b75c6b4d-8725-4808-b1da-91b35b2281a4"

--------------------------------------------------------------------
Task Details
--------------------------------------------------------------------

Operations: content_applicability_regeneration
Resources:
State: Successful
Start Time: 2014-06-20T11:08:03Z
Finish Time: 2014-06-20T11:08:03Z
Result: N/A
Task Id: b75c6b4d-8725-4808-b1da-91b35b2281a4
Progress Report:

Expected results:
400 - if one or more of the parameters is invalid

--- Additional comment from at 06/20/2014 15:00:36 ---

It's the same for a nonexistent consumer

pulp-consumer -p admin status

This consumer is registered to the server
[localhost] with the ID [cheburashka].

curl -i -H "Accept: application/json" -X POST -k -u admin:admin -d '{ "consumer_criteria": { "filters": {"id": {"$in": ["gena"]}}}}' 'https://localhost/pulp/api/v2/consumers/actions/content/regenerate_applicability/'

HTTP/1.1 202 Accepted
Date: Fri, 20 Jun 2014 14:37:48 GMT
Server: Apache/2.2.15 (Red Hat)
Content-Encoding: utf-8
Content-Length: 172
Connection: close
Content-Type: application/json

{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/8ec8c11e-8fcf-479b-99ae-81bce34a9344/", "task_id": "8ec8c11e-8fcf-479b-99ae-81bce34a9344"}], "result": null, "error": null}

pulp-admin -u admin -p admin tasks details --task-id="8ec8c11e-8fcf-479b-99ae-81bce34a9344"

--------------------------------------------------------------------
Task Details
--------------------------------------------------------------------

Operations: content_applicability_regeneration
Resources:
State: Successful
Start Time: 2014-06-20T14:37:49Z
Finish Time: 2014-06-20T14:37:49Z
Result: N/A
Task Id: 8ec8c11e-8fcf-479b-99ae-81bce34a9344
Progress Report:

--- Additional comment from at 06/20/2014 16:37:51 ---

Irina,

Providing a filer with non-existing consumer or repo id is not considered an invalid parameter. It is a valid filter parameter which just doesn't match any existing repos or consumers. This would have been a valid bug if we were using exact consumer and repo ids instead of filters. Closing as not a bug.

--- Additional comment from at 06/30/2014 17:13:42 ---

On 06/24/2014 08:54 AM, Irina Gulina wrote:

Sayli,

On https://bugzilla.redhat.com/show_bug.cgi?id=1111570

What to do if one makes a typo in a repo name or consumer? How s/he will be able to notice that applicability data will not be generated, if 200 OK is returned?

Regards,
Irina

There is no current way to handle that right now and that is pretty much
the case with all the apis accepting criteria. Maybe we can create an
RFE to change such APIs to return a dictionary with list that results
after applying filters, like in this case it will contain a list of
consumers and a list of repos that we are using to generate applicability.

--
Sayli Karmarkar

--- Additional comment from at 09/08/2014 14:40:44 ---

Created attachment 935373
invalid parameter

--- Additional comment from at 09/08/2014 14:43:00 ---

The "Criteria" object just accepts anything the user gives it

It was found on applicability exampel, but it seems the problem is not unique to applicability

https://github.com/pulp/pulp/blob/master/docs/sphinx/dev-guide/integration/rest-api/consumer/applicability.rst#generate-content-applicability-for-updated-consumers

See attachment.

19a406393681ac9fc4e01675f0b1340e (544 Bytes) 19a406393681ac9fc4e01675f0b1340e invalid parameter igulina@redhat.com, 02/19/2015 02:13 AM

History

#1 Updated by bmbouter over 6 years ago

  • Tags deleted (Reopened)

#2 Updated by bmbouter over 2 years ago

  • Status changed from NEW to CLOSED - WONTFIX

#3 Updated by bmbouter over 2 years ago

Pulp 2 is approaching maintenance mode, and this Pulp 2 ticket is not being actively worked on. As such, it is being closed as WONTFIX. Pulp 2 is still accepting contributions though, so if you want to contribute a fix for this ticket, please reopen or comment on it. If you don't have permissions to reopen this ticket, or you want to discuss an issue, please reach out via the developer mailing list.

#4 Updated by bmbouter over 2 years ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF