Publication

Publish a Repository

Publish content from a repository using a repository’s distributor. This call always executes asynchronously and will return a call report.

Method: POST
Path: /pulp/api/v2/repositories/<repo_id>/actions/publish/
Permission: execute
Request Body Contents:
  • id (string) - identifies which distributor on the repository to publish

  • override_config (object) - (optional) distributor configuration values that override the distributor’s default configuration for this publish

Response Codes:
  • 202 - if the publish is set to be executed

  • 404 - if repo does not exist

Return: a Call Report representing the current state of the sync

Sample Request:

{
  "id": "distributor_1",
  "override_config": {},
}

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

Scheduling a Publish

A repository can be published automatically using an iso8601 interval. To create a scheduled publish, the interval, publish override config, and other schedule options must be set on a repository’s distributor.

Method: POST
Path: /pulp/api/v2/repositories/<repo_id>/distributors/<distributor_id>/schedules/publish/
Permission: create
Request Body Contents:
  • schedule (string) - the schedule as an iso8601 interval

  • override_config (object) - (optional) the overridden configuration for the distributor to be used on the scheduled publish

  • failure_threshold (number) - (optional) consecutive failures allowed before this scheduled publish is disabled

  • enabled (boolean) - (optional) whether the scheduled publish is initially enabled (defaults to true)

Response Codes:
  • 201 - if the schedule was successfully created

  • 400 - if one or more of the parameters are invalid

  • 404 - if there is no repository or distributor with the specified IDs

Return: schedule report representing the current state of the scheduled call

Sample Request:

{
 "override_config": {},
 "schedule": "PT1H",
 "failure_threshold": 3,
}

Sample 201 Response Body:

{
 "next_run": "2014-01-27T21:27:56Z",
 "task": "pulp.server.tasks.repository.publish",
 "last_updated": 1390858076.682694,
 "first_run": "2014-01-27T21:27:56Z",
 "schedule": "PT1H",
 "args": [
   "demo",
   "puppet_distributor"
 ],
 "enabled": true,
 "last_run_at": null,
 "_id": "52e6cf5cdd01fb70bd0d9c34",
 "total_run_count": 0,
 "failure_threshold": 3,
 "kwargs": {
   "overrides": {}
 },
 "resource": "pulp:distributor:demo:puppet_distributor",
 "remaining_runs": null,
 "consecutive_failures": 0,
 "_href": "/pulp/api/v2/repositories/demo/distributors/puppet_distributor/schedules/publish/52e6cf5cdd01fb70bd0d9c34/"
}

Updating a Scheduled Publish

The same parameters used to create a scheduled publish may be updated at any point.

Method: PUT
Path: /pulp/api/v2/repositories/<repo_id>/distributors/<distributor_id>/schedules/publish/<schedule_id>/
Permission: create
Request Body Contents:
  • schedule (string) - (optional) new schedule as an iso8601 interval

  • override_config (object) - (optional) new overridden configuration for the importer to be used on the scheduled sync

  • failure_threshold (number) - (optional) new consecutive failures allowed before this scheduled sync is disabled

  • enabled (boolean) - (optional) whether the scheduled sync is enabled

Response Codes:
  • 200 - if the schedule was successfully updated

  • 400 - if one or more of the parameters are invalid

  • 404 - if there is no repository, distributor or schedule with the specified IDs

Return: schedule report representing the current state of the scheduled call (see sample response of Scheduling a Publish for details)

Deleting a Scheduled Publish

Delete a scheduled publish to remove it permanently from the distributor.

Method: DELETE
Path: /pulp/api/v2/repositories/<repo_id>/distributors/<distributor_id>/schedules/publish/<schedule_id>/
Permission: delete
Response Codes:
  • 200 - if the schedule was deleted successfully

  • 404 - if there is no repository, distributor or schedule with the specified IDs

Return: null

Listing All Scheduled Publishes

All of the scheduled publishes for a given distributor may be listed.

Method: GET
Path: /pulp/api/v2/repositories/<repo_id>/distributors/<distributor_id>/schedules/publish/
Permission: read
Response Codes:
  • 200 - if repo, distributor exist

  • 404 - if there is no repository or distributor with the specified IDs

Return: array of schedule reports for all scheduled publishes defined (see sample response of Scheduling a Publish for details)

Sample 200 Response Body:

{
    "_href": "/pulp/api/v2/repositories/test/distributors/yum_distributor/schedules/publish/54d88df045ef4876fb50c994/",
    "_id": "54d88df045ef4876fb50c994",
    "args": [
        "test",
        "yum_distributor"
    ],
    "consecutive_failures": 0,
    "enabled": true,
    "failure_threshold": null,
    "first_run": "2015-02-09T10:37:36Z",
    "kwargs": {
        "overrides": {}
    },
    "last_run_at": "2015-02-09T10:38:23Z",
    "last_updated": 1423478256.805917,
    "next_run": "2015-02-10T10:37:36Z",
    "remaining_runs": null,
    "resource": "pulp:distributor:test:yum_distributor",
    "schedule": "P1DT",
    "task": "pulp.server.tasks.repository.publish",
    "total_run_count": 1
}

Listing a Single Scheduled Publish

Each scheduled publish may be inspected.

Method: GET
Permission: read
Path: /pulp/api/v2/repositories/<repo_id>/distributors/<distributor_id>/schedules/publish/<schedule_id>/
Response Codes:
  • 200 - if repo, distributor or schedule exist

  • 404 - if there is no repository, distributor or schedule with the specified IDs

Return: a schedule report for the scheduled publish (see sample response of Scheduling a Publish for details)

Sample 200 Response Body:

{
   "_href": "/pulp/api/v2/repositories/test/distributors/yum_distributor/schedules/publish/54d88df045ef4876fb50c994/",
   "_id": "54d88df045ef4876fb50c994",
   "args": [
       "test",
       "yum_distributor"
   ],
   "consecutive_failures": 0,
   "enabled": true,
   "failure_threshold": null,
   "first_run": "2015-02-09T10:37:36Z",
   "kwargs": {
       "overrides": {}
   },
   "last_run_at": "2015-02-09T10:38:23Z",
   "last_updated": 1423478256.805917,
   "next_run": "2015-02-10T10:37:36Z",
   "remaining_runs": null,
   "resource": "pulp:distributor:test:yum_distributor",
   "schedule": "P1DT",
   "task": "pulp.server.tasks.repository.publish",
   "total_run_count": 1
}

Retrieving Publish History

Retrieve publish history for a repository. Each publish performed on a repository creates a history entry.

Method: GET
Permission: read
Path: /pulp/api/v2/repositories/<repo_id>/history/publish/<distributor_id>/
Query Parameters:
  • limit (integer) - (optional) the maximum number of history entries to return; if not specified, the entire history is returned

  • sort (string) - (optional) options are ‘ascending’ and ‘descending’; the array is sorted by the publish timestamp

  • start_date (iso8601 datetime) - (optional) any entries with a timestamp prior to the given date are not returned

  • end_date (iso8601 datetime) - (optional) any entries with a timestamp after the given date are not returned

Response Codes:
  • 200 - if the history was successfully retrieved

  • 404 - if the repository id given does not exist

Return: an array of publish history entries

Sample 200 Response Body:

[
 {
  "result": "success",
  "distributor_id": "my_demo_distributor",
  "distributor_type_id": "demo_distributor",
  "exception": null,
  "repo_id": "demo_repo",
  "traceback": null,
  "started": "1970:00:00T00:00:00Z",
  "completed": "1970:00:00T00:00:01Z",
  "error_message": null,
 }
]