Try association for filter, instead of unit. Just ran into this situation in the past week.
▶ Show quoted text On Dec 13, 2015 05:05, "Trey Dockendorf" <[email protected]> wrote: > I'm attempting to cleanup some of my repositories via API, and am finding > I can successfully remove everything except RPMs. Right now I have a repo > like 'centos-6-base' that is synced against CentOS 6 base repo. I then > copy all the content to another repo, 'local-centos-6-base'. Normally I > copy individual RPMs, but now I'd like the local-centos-6-base repo to be a > clone of centos-6-base. I figured the easy way is > delete local-centos-6-base, re-create, then run 'copy all'. However I'd > like to utilize API to remove items from local-centos-6-base that do not > exist in centos-6-base. > > Right now my method is get all units via source = > /api/v2/repositories/centos-6-base/search/units and dest = > /api/v2/repositories/local-centos-6-base/search/units. I then identify the > values for each unit's unit_id that exist in dest but not in source. I > then send a POST request to > /api/v2/repositories/local-centos-6-base/actions/unassociate/ that looks > like this: > > { > 'criteria': { > 'type_ids': [unit_type_id], > 'filters': { > 'unit': { 'unit_id': { '$in' unit_ids } }, > } > } > } > > The unit_ids is a Python list that contains all the "unit_id" values that > existed in dest but not in source. The unit_ids all have the same > "unit_type_id". So far this method seems to have worked for type_ids > "package_group" and "package_category" but not for "rpm". > > Any suggestions on what I'm doing wrong? > > Thanks, > - Trey > > > _______________________________________________ > Pulp-list mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/pulp-list >
_______________________________________________ Pulp-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/pulp-list
