pulp_gem
Plugin
This is the pulp_gem
Plugin for Pulp Project
3.0+. This plugin adds importers and distributors
for rubygems.
All REST API examples below 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
pulpcore
Install Follow the installation instructions provided with pulpcore.
pulp-gem
from source
Install - sudo -u pulp -i
- source ~/pulpvenv/bin/activate
- git clone https://github.com/ATIX-AG/pulp_gem
- cd pulp_gem
- python setup.py develop
- django-admin makemigrations pulp_gem
- django-admin migrate pulp_gem
- django-admin runserver 24817
- gunicorn pulpcore.content:server --bind 'localhost:24816' --worker-class 'aiohttp.GunicornWebWorker' -w 2
- sudo systemctl restart pulpcore-resource-manager
- sudo systemctl restart pulpcore-worker@1
- sudo systemctl restart pulpcore-worker@2
pulp-gem
From PyPI
Install - sudo -u pulp -i
- source ~/pulpvenv/bin/activate
- pip install pulp-gem
- django-admin makemigrations pulp_gem
- django-admin migrate pulp_gem
- django-admin runserver 24817
- gunicorn pulpcore.content:server --bind 'localhost:24816' --worker-class 'aiohttp.GunicornWebWorker' -w 2
- sudo systemctl restart pulpcore-resource-manager
- sudo systemctl restart pulpcore-worker@1
- sudo systemctl restart pulpcore-worker@2
foo
Create a repository $ http POST http://localhost:24817/pulp/api/v3/repositories/ name=foo
{
"pulp_href": "/pulp/api/v3/repositories/1/",
"...": "..."
}
$ export REPO_HREF=$(http :24817/pulp/api/v3/repositories/ | jq -r '.results[] | select(.name == "foo") | .pulp_href')
Add a remote
$ http POST http://localhost:24817/pulp/api/v3/remotes/gem/ name='bar' url='https://rubygems.org/' policy='streamed'
{
"pulp_href": "/pulp/api/v3/remotes/gem/1/",
"..." : "..."
}
$ export REMOTE_HREF=$(http :24817/pulp/api/v3/remotes/gem/ | jq -r '.results[] | select(.name == "bar") | .pulp_href')
foo
using remote bar
Sync repository $ http POST ':24817'${REMOTE_HREF}'sync/' repository=$REPO_HREF
foo-0.0.1.gem
to Pulp
Upload Create an Artifact by uploading the gemfile to Pulp.
$ http --form POST http://localhost:24817/pulp/api/v3/artifacts/ file@./foo-0.0.1.gem
{
"pulp_href": "/pulp/api/v3/artifacts/1/",
"...": "..."
}
You need to upload the corresponding foo-0.0.1.gemspec.rz
in the same way.
gem
content from an Artifact
Create $ http POST http://localhost:24817/pulp/api/v3/content/gem/gems/ _artifact="/pulp/api/v3/artifacts/1/"
{
"pulp_href": "/pulp/api/v3/content/gem/gems/1/",
"_artifacts": {
"gems/foo-0.0.1.gem":"/pulp/api/v3/artifacts/1/",
"quick/Marshal.4.8/foo-0.0.1.gemspec.rz":"/pulp/api/v3/artifacts/2/"
},
"name": "foo",
"notes": {},
"type": "gem",
"version": "0.0.1"
}
$ export CONTENT_HREF=$(http :24817/pulp/api/v3/content/gem/gems/ | jq -r '.results[] | select(.name == "foo") | .pulp_href')