Copying Units Between Repositories

Pulp provides the ability to copy units between repositories. Units to copy are specified through a unit association criteria applied to a source repository. The filters field is used to match units, and the fields field is optionally used to limit which fields will be loaded into RAM and handed off to the importer. Limiting which fields are loaded can reduce the consumption of RAM, especially when the units have a lot of metadata. All matching units are imported into the destination repository.

The only restriction is that the destination repository must be configured with an importer that supports the type of units being copied.

Method: POST
Path: /pulp/api/v2/repositories/<destination_repo_id>/actions/associate/
Permission: update
Request Body Contents:
  • source_repo_id (string) - repository from which to copy units
  • criteria (criteria document) - (optional) filters which units to copy from the source repository
  • override_config (object) - (optional) importer configuration values that override the importer’s default configuration
Response Codes:
  • 202 - if the request was accepted by the server to execute asynchronously
Return: a Call Report

Sample Request:

{
  'source_repo_id' : 'pulp-f17',
  'criteria': {
    'type_ids' : ['rpm'],
    'filters' : {
      'unit' : {
        '$and': [{'name': {'$regex': 'p.*'}}, {'version': {'$gt': '1.0'}}]
      }
    }
  },
 'override_config': {
   'recursive': true
  },
}

Sample result value:

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

Tags: The task created will have the following tags. "pulp:repository:<source_repo_id>", "pulp:consumer:<destination_repo_id>", "pulp:action:associate"

Unassociating Content Units from a Repository

Pulp also provides the ability to unassociate units from a repository. Units to unassociate are specified through a Unit Association Criteria applied to the repository. All matching units are unassociated from the repository.

The only restriction is that the content units can only be unassociated by the same person that originally associated the units with the repository.

Note that there is a bug related to this call in which criteria with no type_ids field will remove all units in a repository.

Method: POST
Path: /pulp/api/v2/repositories/<repo_id>/actions/unassociate/
Permission: update
Request Body Contents:
  • criteria (criteria document) - filters which units to unassociate from the repository
Response Codes:
  • 202 - if the request was accepted by the server to execute asynchronously
Return: a Call Report

Tags: The task created will have the following tags. "pulp:repository:<repo_id>", "pulp:action:unassociate"