That works, at least sort of.  I noticed that the unit_id values for
non-rpm content types don't seem to be unique between repos.  Also my
script failed to remove ~2000 RPMs from my local-centos-6-base repo.
Curious if there's some special technique required to make one repo a
mirror of the other when one only receives content via "copy".  My goal is
to sync centos-6-base using feed URL, then copy individual content as
needed into local-centos-6-base.  Occasionally, like I am doing now, I'd
like the local-centos-6-base repo to be a mirror of centos-6-base.  I'm
thinking the best option is either delete and recreate my
local-centos-6-base repo and run 'copy all' or add a feed to that repo
that's the same as centos-6-base with --remove-missing added.

If anyone has done something similar, I'd be interested to know how this
problem was solved.

Thanks,
- Trey

On Sun, Dec 13, 2015 at 7:37 AM, Mihai Ibanescu <mihai.ibane...@gmail.com>
wrote:

> 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" <treyd...@gmail.com> 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
>> Pulp-list@redhat.com
>> https://www.redhat.com/mailman/listinfo/pulp-list
>>
>
_______________________________________________
Pulp-list mailing list
Pulp-list@redhat.com
https://www.redhat.com/mailman/listinfo/pulp-list

Reply via email to