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.
jdob has confirmed that we will limit this feature to the unit search API only.
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 ?
That should be "ID" or Repo_id
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
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.
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".
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 ~]#
Pulp v2.0 released