Orphaned Content

Content units (see content unit) in Pulp are brought in as part of repository sync and content upload operations. However, because content can be associated with more than one repository, content is not removed when the repositories it is associated with are removed or when the content is disassociated with repositories.

Instead, if content is no longer associated with any repositories, it is considered orphaned.

Orphaned content may be viewed and removed from Pulp using the following REST calls.

Content types are defined by type definitions.

Viewing Orphaned Content

View All Orphaned Content

Get a summary view of the orphaned units by content type

Method: GET
Path: /pulp/api/v2/content/orphans/
Permission: read
Response Codes:
  • 200 - even if no orphaned content is found
Return: summary of orphaned packages by content type

Sample 200 Response Body:

{
 {'rpm': {'count': 21,
          '_href': '/pulp/api/v2/content/orphans/rpm/'},
 {'drpm': {'count': 0,
           '_href': '/pulp/api/v2/content/orphans/drpm/'},
}

View Orphaned Content by Type

List all the orphaned content of a particular content type.

Method: GET
Path: /pulp/api/v2/content/orphans/<content_type_id>/
Permission: read
Response Codes:
  • 200 - even if no orphaned content is found
  • 404 - if the content type does not exist
Return: (possibly empty) array of content units

Sample 200 Response Body:

{
 [
 {'_content_type_id': 'rpm',
  '_href': '/pulp/api/v2/content/orphans/rpm/d0dc2044-1edc-4298-bf10-a472ea943fe1/',
  '_id': 'd0dc2044-1edc-4298-bf10-a472ea943fe1',
  '_ns': 'units_rpm',
  '_storage_path': '/var/lib/pulp/content/rpm/.//gwt/2.3.0/1.fc16/noarch/c55f30d742a5dade6380a499df9fbf5e6bf35a316acf3774b261592cc8e547d5/gwt-2.3.0-1.fc16.noarch.rpm',
  'arch': 'noarch',
  'buildhost': 'localhost',
  'checksum': 'c55f30d742a5dade6380a499df9fbf5e6bf35a316acf3774b261592cc8e547d5',
  'checksumtype': 'sha256',
  'description': 'Writing web apps today is a tedious and error-prone process.  Developers can\nspend 90% of their time working around browser quirks. In addition, building,\nreusing, and maintaining large JavaScript code bases and AJAX components can be\ndifficult and fragile. Google Web Toolkit (GWT) eases this burden by allowing\ndevelopers to quickly build and maintain complex yet highly performant\nJavaScript front-end applications in the Java programming language.',
  'epoch': '0',
  'filename': 'gwt-2.3.0-1.fc16.noarch.rpm',
  'license': 'ASL 2.0',
  'name': 'gwt',
  'relativepath': 'gwt-2.3.0-1.fc16.noarch.rpm',
  'release': '1.fc16',
  'vendor': '',
  'version': '2.3.0'},
 {'_content_type_id': 'rpm',
  '_href': '/pulp/api/v2/content/orphans/rpm/5b8982b3-1d57-4822-92e5-effa0d4f0a17/',
  '_id': '5b8982b3-1d57-4822-92e5-effa0d4f0a17',
  '_ns': 'units_rpm',
  '_storage_path': '/var/lib/pulp/content/rpm/.//gwt-javadoc/2.3.0/1.fc16/noarch/00da925d1a828f7e3985683ff68043523fe42ec3f1030f449cfddcc5854f6de1/gwt-javadoc-2.3.0-1.fc16.noarch.rpm',
  'arch': 'noarch',
  'buildhost': 'localhost',
  'checksum': '00da925d1a828f7e3985683ff68043523fe42ec3f1030f449cfddcc5854f6de1',
  'checksumtype': 'sha256',
  'description': 'Javadoc for gwt.',
  'epoch': '0',
  'filename': 'gwt-javadoc-2.3.0-1.fc16.noarch.rpm',
  'license': 'ASL 2.0',
  'name': 'gwt-javadoc',
  'relativepath': 'gwt-javadoc-2.3.0-1.fc16.noarch.rpm',
  'release': '1.fc16',
  'vendor': '',
  'version': '2.3.0'},
 {'_content_type_id': 'rpm',
  '_href': '/pulp/api/v2/content/orphans/rpm/228762de-9762-4384-b41a-4ccc594467f9/',
  '_id': '228762de-9762-4384-b41a-4ccc594467f9',
  '_ns': 'units_rpm',
  '_storage_path': '/var/lib/pulp/content/rpm/.//autotest/0.13.0/6.fc16/noarch/1c0009934068204b3937e49966b987ae925924b0922656640f39bcd0e85d52cd/autotest-0.13.0-6.fc16.noarch.rpm',
  'arch': 'noarch',
  'buildhost': 'localhost',
  'checksum': '1c0009934068204b3937e49966b987ae925924b0922656640f39bcd0e85d52cd',
  'checksumtype': 'sha256',
  'description': u"Autotest is a framework for fully automated testing. It is designed primarily\nto test the Linux kernel, though it is useful for many other functions such as\nqualifying new hardware. It's an open-source project under the GPL and is used\nand developed by a number of organizations, including Google, IBM, and many\nothers.\n\nThe autotest package provides the client harness capable of running autotest\njobs on a single system.",
  'epoch': '0',
  'filename': 'autotest-0.13.0-6.fc16.noarch.rpm',
  'license': 'GPLv2 and BSD and LGPLv2.1+',
  'name': 'autotest',
  'relativepath': 'autotest-0.13.0-6.fc16.noarch.rpm',
  'release': '6.fc16',
  'vendor': '',
  'version': '0.13.0'},
 ]
}

The individual fields of the content units returned will vary by type. The above sample is provided as a demonstration only and does not necessarily reflect the exact return types of all calls. However all fields beginning with a _ will be available in all content units, regardless of type.

View an Individual Orphaned Content Unit

Retrieve an individual orphaned content unit by content type and content id.

Method: GET
Path: /pulp/api/v2/content/orphans/<content_type_id>/<content_unit_id>/
Permission: read
Response Codes:
  • 200 - if the orphaned content unit is found
  • 404 - if the orphaned content unit does not exist
Return: content unit

Removing Orphaned Content

Removing orphans may entail deleting contents from disk and, as such, may possibly be long-running process, so all these calls run asynchronously and return a Call Report

Remove All Orphaned Content

Remove all orphaned content units, regardless of type. The task that gets instantiated will have a count of units that get deleted indexed by content type id in the result field once the task completes successfully.

Method: DELETE
Path: /pulp/api/v2/content/orphans/
Permission: delete
Response Codes:
  • 202 - even if no content is to be deleted
Return: a Call Report

Tags: The task created will have the following tag. "pulp:content_unit:orphans"

Remove Orphaned Content by Type

Remove all the orphaned content of a particular content type.

Method: DELETE
Path: /pulp/api/v2/content/orphans/<content_type_id>/
Permission: delete
Response Codes:
  • 202 - even if no content is to be deleted
  • 404 - if content type does not exist
Return: a Call Report

Tags: The task created will have the following tag. "pulp:content_unit:orphans"

Remove an Individual Orphaned Content Unit

Remove and individual orphaned content unit by content type and content id.

Method: DELETE
Path: /pulp/api/v2/content/orphans/<content_type_id>/<content_unit_id>/
Permission: delete
Response Codes:
  • 202 - if the content unit is to be deleted
  • 404 - if the content unit or content type does not exist
Return: a Call Report

Tags: The task created will have the following tag. "pulp:content_unit:orphans"

Remove Orphaned Content Units by Type and Id

Deprecated since version 2.4: Please use /v2/content/orphans/ instead for deletions.

Individual content units across types may be deleted by this call. The body of the call consists of an array of JSON objects with the fields:

  • content_type_id: also known as the content_type_id
  • unit_id: also known as the content_unit_id
Method: POST
Path: /pulp/api/v2/content/actions/delete_orphans/
Permission: delete
Request Body Contents:
  • (array) - jSON object containing the content_type_id and unit_id fields
Response Codes:
  • 202 - even if not content is to be deleted
Return: a Call Report

Sample Request:

{
 [{'content_type_id': 'rpm', 'unit_id': 'd0dc2044-1edc-4298-bf10-a472ea943fe1'},
  {'content_type_id': 'rpm', 'unit_id': '228762de-9762-4384-b41a-4ccc594467f9'}]
}

Tags: The task created will have the following tag. "pulp:content_unit:orphans"