Skip to main content

File plugin for the Pulp Project

Project description

This is the pulp_file Plugin for Pulp Project 3.0+. This plugin replaces the ISO support in the pulp_rpm plugin for Pulp 2. This plugin uses the ChangeSet API to add and remove content from a repository.

All REST API examples bellow use httpie to perform the requests. The httpie commands below assume that the user executing the commands has a .netrc file in the home directory. The .netrc should have the following configuration:

machine localhost
login admin
password admin

If you configured the admin user with a different password, adjust the configuration accordingly. If you prefer to specify the username and password with each request, please see httpie documentation on how to do that.

This documentation makes use of the jq library to parse the json received from requests, in order to get the unique urls generated when objects are created. To follow this documentation as-is please install the jq library with:

$ sudo dnf install jq

Install pulpcore

Follow the installation instructions provided with pulpcore.

Users should install from either PyPI or source.

Install pulp-file from source

sudo -u pulp -i
source ~/pulpvenv/bin/activate
git clone https://github.com/pulp/pulp_file.git
cd pulp_file
pip install -e .

Install pulp-file From PyPI

sudo -u pulp -i
source ~/pulpvenv/bin/activate
pip install pulp-file

Make and Run Migrations

export DJANGO_SETTINGS_MODULE=pulpcore.app.settings
django-admin makemigrations file
django-admin migrate file

Run Services

django-admin runserver
gunicorn pulpcore.content:server --bind 'localhost:8080' --worker-class 'aiohttp.GunicornWebWorker' -w 2
sudo systemctl restart pulp-resource-manager
sudo systemctl restart pulp-worker@1
sudo systemctl restart pulp-worker@2

Create a repository foo

$ http POST http://localhost:8000/pulp/api/v3/repositories/ name=foo

{
    "_href": "/pulp/api/v3/repositories/1/",
    ...
}

$ export REPO_HREF=$(http :8000/pulp/api/v3/repositories/ | jq -r '.results[] | select(.name == "foo") | ._href')

Create a new remote bar

$ http POST http://localhost:8000/pulp/api/v3/remotes/file/file/ name='bar' url='https://repos.fedorapeople.org/pulp/pulp/demo_repos/test_file_repo/PULP_MANIFEST'

{
    "_href": "/pulp/api/v3/remotes/file/file/1/",
    ...
}

$ export REMOTE_HREF=$(http :8000/pulp/api/v3/remotes/file/file/ | jq -r '.results[] | select(.name == "bar") | ._href')

Sync repository foo using remote bar

$ http POST ':8000'$REMOTE_HREF'sync/' repository=$REPO_HREF mirror=True

Look at the new Repository Version created

$ http GET ':8000'$REPO_HREF'versions/1/'

{
    "_added_href": "/pulp/api/v3/repositories/1/versions/1/added_content/",
    "_content_href": "/pulp/api/v3/repositories/1/versions/1/content/",
    "_href": "/pulp/api/v3/repositories/1/versions/1/",
    "_removed_href": "/pulp/api/v3/repositories/1/versions/1/removed_content/",
    "content_summary": {
        "file": 3
    },
    "created": "2018-02-23T20:29:54.499055Z",
    "number": 1
}

Upload foo.tar.gz to Pulp

Create an Artifact by uploading the file to Pulp.

$ http --form POST http://localhost:8000/pulp/api/v3/artifacts/ file@./foo.tar.gz

{
    "_href": "/pulp/api/v3/artifacts/1/",
    ...
}

Create file content from an Artifact

Create a content unit and point it to your artifact

$ http POST http://localhost:8000/pulp/api/v3/content/file/files/ relative_path=foo.tar.gz _artifact="/pulp/api/v3/artifacts/1/"

{
    "_href": "/pulp/api/v3/content/file/files/1/",
    "_artifact": "/pulp/api/v3/artifacts/1/",
    "relative_path": "foo.tar.gz",
    "type": "file"
}

$ export CONTENT_HREF=$(http :8000/pulp/api/v3/content/file/files/ | jq -r '.results[] | select(.relative_path == "foo.tar.gz") | ._href')

Add content to repository foo

$ http POST ':8000'$REPO_HREF'versions/' add_content_units:="[\"$CONTENT_HREF\"]"

Create a file Publisher

$ http POST http://localhost:8000/pulp/api/v3/publishers/file/file/ name=bar

{
    "_href": "/pulp/api/v3/publishers/file/file/1/",
    ...
}

$ export PUBLISHER_HREF=$(http :8000/pulp/api/v3/publishers/file/file/ | jq -r '.results[] | select(.name == "bar") | ._href')

Use the bar Publisher to create a Publication

$ http POST ':8000'$PUBLISHER_HREF'publish/' repository=$REPO_HREF

{
    "task": "/pulp/api/v3/tasks/fd4cbecd-6c6a-4197-9cbe-4e45b0516309/"
}

$ export PUBLICATION_HREF=$(http :8000/pulp/api/v3/publications/ | jq -r --arg PUBLISHER_HREF "$PUBLISHER_HREF" '.results[] | select(.publisher==$PUBLISHER_HREF) | ._href')

Create a Distribution for the Publication

$ http POST http://localhost:8000/pulp/api/v3/distributions/ name='baz' base_path='foo' publication=$PUBLICATION_HREF

{
    "_href": "/pulp/api/v3/distributions/1/",
   ...
}

Download test.iso from Pulp

$ http GET http://localhost:8080/pulp/content/foo/test.iso

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pulp-file-0.0.1b9.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

pulp_file-0.0.1b9-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file pulp-file-0.0.1b9.tar.gz.

File metadata

  • Download URL: pulp-file-0.0.1b9.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for pulp-file-0.0.1b9.tar.gz
Algorithm Hash digest
SHA256 4d8176116e51fcb4c740a9dcf06bcc7e0dc84abe9055eb16da19686b4b8f46ab
MD5 f4068593aaee05d1b9ef26512efaaa3e
BLAKE2b-256 fd8408e44e65803b9d11531dce18cbe72f618d63ee4b53b5eda5ff385c65941e

See more details on using hashes here.

File details

Details for the file pulp_file-0.0.1b9-py3-none-any.whl.

File metadata

  • Download URL: pulp_file-0.0.1b9-py3-none-any.whl
  • Upload date:
  • Size: 33.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for pulp_file-0.0.1b9-py3-none-any.whl
Algorithm Hash digest
SHA256 5b3d6a351c753746de5221acc52719fda2e6f2bedd6da5c6b274d40895f428a6
MD5 e6d51dda543a0c9bebac522363cb37c5
BLAKE2b-256 c5f33f4ceda0ef49866ec7207a47329f5642b9008b54334fced3412a60d6053f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page