Project

Profile

Help

Story #5067

Updated by dalley over 4 years ago

h3. Motivation 

 Dependencies for content can be present in multiple repositories. 
 The problem existed before but became more apparent with the introduction of modularity. 
 Sometimes repositories are split into 2, modular and non-modular, instead of being a hybrid repo. 
 For such cases it's essential to have an ability to specify multiple pairs of source/target repositories, otherwise dependency soling can't be performed correctly. 

 h4. Suggestion 

 Modify the unit association API endpoint[0] to accept a new additional argument.    *edit: dalley* Instead of    a new parameter, we pass it through the override config - this prevents other plugins from being impacted by a change to the method signatures.    While it's not "ideal", there is precedent for it because that's how the recursive flags work. 

 *POST* to */pulp/api/v2/repositories/<destination_repo_id>/actions/associate/* will take an optional parameter called *additional_repos*. This will be a dictionary where each key is a source repository id and the value is the destination repository id. The additional repositories would then also be used during the recursive copy only. The dispatched task will need to lock on all the destination repositories.  

 h4. Sample request: 


 <pre> 
 { 
   'source_repo_id' : 'pulp-f17', 
   'criteria': { 
     'type_ids' : ['rpm'], 
     'filters' : { 
       'unit' : { 
         '$and': [{'name': {'$regex': 'p.*'}}, {'version': {'$gt': '1.0'}}] 
       } 
     } 
   }, 
  'override_config': { 
    'recursive': true, 
    'additional_repos': {'source2': 'destination2', 'source3': 'destination3'}, 
  'override_config': { 
    'recursive': true 
   }, 
 } 

 </pre> 

 *The response format will stay the same as it is now:* 

 <pre> 
 "result": { 
   "units_successful": [ 
     { 
       "unit_key": { 
         "name": "whale", 
         "checksum": "3b34234afc8b8931d627f8466f0e4fd352145a2512681ec29db0a051a0c9d893", 
         "epoch": "0", 
         "version": "0.2", 
         "release": "1", 
         "arch": "noarch", 
         "checksumtype": "sha256" 
       }, 
       "type_id": "rpm" 
     } 
   ] 
 } 
 </pre> 


 [0] https://docs.pulpproject.org/dev-guide/integration/rest-api/content/associate.html#copying-units-between-repositories

Back