Story #262

[RFE] Define API call to search for a package in all the consumers

Added by almost 7 years ago. Updated almost 3 years ago.

Start date:
Due date:
% Done:


Estimated time:
Platform Release:
Sprint Candidate:
Pulp 2


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

Description of problem:

Description of problem:

It makes sense to have an API call to search for a specific package, reporting his status for each consumers.

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

How reproducible:

Steps to Reproduce:

Actual results:

Expected results:

Additional info:

--- Additional comment from at 10/27/2014 12:45:58 ---

Do you have suggestion or guideline about the API implementation?

--- Additional comment from at 11/04/2014 16:35:15 ---

I think that this is already possible without any code changes. Can you try to achieve a search like that using the Advanced Search for Consumers [0]? You should be able to form GET style parameters that adhere to the search API [1].

When playing with the API I like to use a tool called pic [2]. Here's a pic hello world example:

from pulp.common import pic
pic.GET ('/pulp/api/v2/consumers/search/')


--- Additional comment from at 11/04/2014 22:17:12 ---

Here is an unrelated example, except that it uses the search API. Here is how I search for tasks that are in the running state:

from pulp.common import pic

body = {"criteria": {"filters": {"state":"running"}}}
pic.POST ('/pulp/api/v2/tasks/search/', body)

The Search API json is used as the payload of the POST to the URL. I wanted to paste this here since I already had it and it is a related example.

--- Additional comment from at 11/05/2014 09:42:41 ---

I don't think that's possible but i will try to investigate...

Tell me if i'm wrong:
/pulp/api/v2/tasks/search/ -> search on the 'tasks_status' mongo table
/pulp/api/v2/consumers/search/ -> search on the 'consumers' mongo table

Is it correct?

--- Additional comment from at 11/06/2014 14:17:03 ---

After some discussion on IRC it was determined:

The URLs in comment 4 don't search on the consumer_unit_profile. Apparently no URL actually provides search on that table so introducing a new URL seems like the right thing to do.

I propose the following URL be introduced:


This is consistent with the existing consumer search URLs for bindings for example:


Also, since this is a reverse compatible new API change it would need to be introduced in a 2.Y release.

--- Additional comment from at 11/12/2014 09:24:36 ---

Pull request submitted here:

--- Additional comment from at 11/13/2014 16:39:02 ---

Merged to master. QA, please see the docs that were added [0] to test this feature.


--- Additional comment from at 12/23/2014 20:52:59 ---

fixed in pulp 2.6.0-0.2.beta

--- Additional comment from at 02/02/2015 21:34:13 ---


GET worked fine for me
but for post doesnt return any respone

pic.POST ('/v2/consumers/profile/search/',body={"criteria": { "filters": {"profile_name": "screen"},"fields": ["consumer_id","foo"] }})

Request Body
"criteria": {
"fields": [
"filters": {
"profile_name": "screen"
Response Body
(200, [])

I do have a consumer foo.

pic.GET ('/v2/consumers/')

Response Body
"display_name": "foo",
"description": null,
"_ns": "consumers",
"notes": {
"_node-update-strategy": "additive",
"_child-node": true

--- Additional comment from at 02/03/2015 14:57:37 ---

Looks like it was user error.
Moving to verified
[root@cloud-qe-4 ~]# rpm -qa |grep pulp-server
I used profile_name instead of

When used with the correct response is given.

pic.POST ('/v2/consumers/profile/search/',body={"criteria": { "filters": {"": "screen"},"fields": ["consumer_id","foo"] }})

Request Body
"criteria": {
"fields": [
"filters": {
"": "screen"
Response Body
"_id": {
"$oid": "54cad13f9f9b813d5b604cfc"
"id": "54cad13f9f9b813d5b604cfc",
"consumer_id": "foo"
(200, [{u'_id': {u'$oid': u'54cad13f9f9b813d5b604cfc'}, u'id': u'54cad13f9f9b813d5b604cfc', u'consumer_id': u'foo'}])

--- Additional comment from at 02/05/2015 21:49:57 ---

Moving to verified, as per Preethi's comment.


#1 Updated by bmbouter almost 7 years ago

  • Status changed from NEW to 6

This was already at VERIFIED state in Bugzilla. There was an error in the migration into Redmine. This change sets the correct state.

#2 Updated by rbarlow over 6 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE

#4 Updated by bmbouter almost 3 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF