Bug 854260 - RFE: Units should include associated list of repo_ids
Summary: RFE: Units should include associated list of repo_ids
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: API/integration
Version: 2.0.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: Sprint 40
Assignee: Michael Hrivnak
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks: katello-v2-pulp
TreeView+ depends on / blocked
 
Reported: 2012-09-04 14:03 UTC by Justin Sherrill
Modified: 2013-09-09 15:44 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-01-09 17:05:04 UTC
Embargoed:


Attachments (Terms of Use)

Description Justin Sherrill 2012-09-04 14:03:02 UTC
Description of problem:

In Pulpv1 Packages and Errata included repo_ids as part of their attributes.  In Pulpv2 it does not.  This hinders our search indexing capabilities.  


Basically what we need to do be able to do is query any unit (rpm, errata, etc..) by:

1.  id   (single unit)
2.  repo_id  (list of units)

and be returned units that include as an attribute for each unit, the list of repo_ids that the unit belongs to.  


Couple of examples:

1.  List packages in a repo and know for each package what repositories that pacakge is in
2.  Query a single package by ID and know what repositories that packages is in.

Comment 1 Michael Hrivnak 2012-09-12 18:54:17 UTC
jdob has confirmed that we will limit this feature to the unit search API only.

Comment 2 Justin Sherrill 2012-09-12 19:07:59 UTC
When you say limit this feature to the unit search api only, does this mean that I can still accomplish the two examples above?  

Querying by ID & Repo_id and getting the list of units, each containing repo_ids ?

Comment 3 Justin Sherrill 2012-09-12 19:08:40 UTC
That should be "ID" or Repo_id

Comment 4 Michael Hrivnak 2012-09-12 19:20:06 UTC
Yes, although you have to include a unit_type_id as well (which is part of the URL). I think it's always (at least for V2) been the case that a unit is uniquely identified by a unit_id and unit_type_id.

So I am just adding the feature to this search:

http://pulp-rest-api.readthedocs.org/en/latest/content/retrieval.html

Comment 5 Michael Hrivnak 2012-09-12 20:29:03 UTC
I misspoke. You cannot use this method to search by repo_id. This method lets you search units based on their own attributes and display what repos they belong to.

I do not believe we are planning to support a search for units within a repo that also shows what other repos those units belong to. If that is desired, you should probably ask jdob about it.

Comment 6 Michael Hrivnak 2012-09-26 18:09:55 UTC
Work for this was done here: https://github.com/pulp/pulp/pull/50

Documentation of the new feature is here:

http://pulp-dev-guide.readthedocs.org/en/latest/rest-api/content/retrieval.html

Look for the optional parameter "include_repos"

You can test this by performing a search for content units with the REST API and including the "include_repos" argument in the POST data with some value that will evaluate as True. You should see an attribute on each returned document called "repository_memberships".

Comment 7 Preethi Thomas 2012-10-24 21:18:31 UTC
verified
[root@pulp-master ~]# rpm -qa pulp-rpm-server
pulp-rpm-server-0.0.333-1.fc17.noarch

[root@pulp-master ~]#  curl -k -u admin:admin   "https://localhost//pulp/api/v2/content/units/srpm/search/?field=id&field=display_name&limit=2&include_repos=repository_memberships=1"  |json_reformat
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   366  100   366    0     0   1814      0 --:--:-- --:--:-- --:--:--  1830
[
    {
        "_id": "7646e8c6-2efb-4aee-b5cd-538b0431a20b",
        "_href": "/pulp/api/v2/content/units/srpm/7646e8c6-2efb-4aee-b5cd-538b0431a20b/",
        "children": {

        },
        "repository_memberships": [
            "srpm"
        ]
    },
    {
        "_id": "61f31ad0-13dc-409e-9541-0938d975a074",
        "_href": "/pulp/api/v2/content/units/srpm/61f31ad0-13dc-409e-9541-0938d975a074/",
        "children": {

        },
        "repository_memberships": [
            "srpm"
        ]
    }
]
[root@pulp-master ~]#

Comment 8 Preethi Thomas 2013-01-09 17:05:04 UTC
Pulp v2.0 released


Note You need to log in before you can comment on or make changes to this bug.