Export

Filesystem

This section describes how to export file content to the filesystem. Exporting content to the filesystem is useful if you want to serve content with your own web server and not use Pulp’s Content App, or if you want to transfer your content to another location (via rsync, etc).

If DEFAULT_FILE_STORAGE is filesystem, the FilesystemExporter will create hard links. Otherwise, it will fetch and write the content to the filesystem.

This example assumes you have a Publication and that publication’s href is stored as $PUBLICATION_HREF.

First, create a FilesystemExporter and give it the desired path. Your ALLOWED_EXPORT_PATHS setting must include this path.

#!/usr/bin/env bash

# TODO: convert file to pulp-cli once the filesystem exporter commands are implemented

export EXPORTER_NAME=$(head /dev/urandom | tr -dc a-z | head -c5)
export DEST_DIR=$(mktemp -d -t export-XXXXXXXX)

echo "Created a new file system exporter $EXPORTER_NAME."
export EXPORTER_HREF=$(http POST $BASE_ADDR/pulp/api/v3/exporters/file/filesystem/ \
  name=$EXPORTER_NAME path=$DEST_DIR | jq -r '.pulp_href')

Next you can use this exporter to create a filesystem export that will export your Publication’s content to the filesystem.

#!/usr/bin/env bash

# TODO: convert file to pulp-cli once the filesystem exporter commands are implemented

export TASK_URL=$(http POST $BASE_ADDR$EXPORTER_HREF'exports/' publication=$PUBLICATION_HREF \
  | jq -r '.task')

pulp task show --wait --href $TASK_URL

echo "Inspecting export at $DEST_DIR"
ls $DEST_DIR