Bug 854260 - RFE: Units should include associated list of repo_ids
RFE: Units should include associated list of repo_ids
Product: Pulp
Classification: Community
Component: API/integration (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: Sprint 40
Assigned To: Michael Hrivnak
Preethi Thomas
: FutureFeature, Triaged
Depends On:
Blocks: katello-v2-pulp
  Show dependency treegraph
Reported: 2012-09-04 10:03 EDT by Justin Sherrill
Modified: 2013-09-09 11:44 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-01-09 12:05:04 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Justin Sherrill 2012-09-04 10:03:02 EDT
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 14:54:17 EDT
jdob has confirmed that we will limit this feature to the unit search API only.
Comment 2 Justin Sherrill 2012-09-12 15:07:59 EDT
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 15:08:40 EDT
That should be "ID" or Repo_id
Comment 4 Michael Hrivnak 2012-09-12 15:20:06 EDT
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:

Comment 5 Michael Hrivnak 2012-09-12 16:29:03 EDT
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 14:09:55 EDT
Work for this was done here: https://github.com/pulp/pulp/pull/50

Documentation of the new feature is here:


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 17:18:31 EDT
[root@pulp-master ~]# rpm -qa pulp-rpm-server

[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": [
        "_id": "61f31ad0-13dc-409e-9541-0938d975a074",
        "_href": "/pulp/api/v2/content/units/srpm/61f31ad0-13dc-409e-9541-0938d975a074/",
        "children": {

        "repository_memberships": [
[root@pulp-master ~]#
Comment 8 Preethi Thomas 2013-01-09 12:05:04 EST
Pulp v2.0 released

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