Skip to content

Commit 72f496d

Browse files
authored
Merge pull request #242 from asmacdo/master-detail-publications
Swith to Master/Detail Publications
2 parents fead893 + 4a25515 commit 72f496d

23 files changed

+370
-414
lines changed

docs/_scripts/base.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export BASE_ADDR=http://localhost:24817
2+
export CONTENT_ADDR=http://localhost:24816
3+
4+
wait_for_pulp() {
5+
unset CREATED_RESOURCE
6+
local task_url=$1
7+
while [ -z "$CREATED_RESOURCE" ]
8+
9+
do
10+
sleep 1
11+
export CREATED_RESOURCE=$(http $BASE_ADDR$task_url | jq -r '.created_resources | first')
12+
done
13+
}

docs/_scripts/clean.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pstop
2+
pclean
3+
prestart
4+
pip uninstall -y shelf-reader
5+
6+
echo "is shelf reader installed?"
7+
pip freeze | grep shelf-reader

docs/_scripts/distribution.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Distributions are created asynchronously. Create one, and specify the publication that will
2+
# be served at the base path specified.
3+
export TASK_URL=$(http POST $BASE_ADDR/pulp/api/v3/distributions/ \
4+
name='baz' \
5+
base_path='foo' \
6+
publication=$PUBLICATION_HREF | jq -r '.task')
7+
8+
# Poll the task (here we use a function defined in docs/_scripts/base.sh)
9+
# When the task is complete, it gives us the href for our new Distribution
10+
wait_for_pulp $TASK_URL
11+
export DIST_PATH=${CREATED_RESOURCE[0]}
12+
13+
# Lets inspect the Distribution
14+
http $BASE_ADDR$DIST_PATH

docs/_scripts/pip.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
echo 'pip install --trusted-host localhost -i $CONTENT_ADDR/pulp/content/foo/simple/ shelf-reader'
2+
pip install --trusted-host localhost -i $CONTENT_ADDR/pulp/content/foo/simple/ shelf-reader
3+
4+
echo "is shelf reader installed?"
5+
pip freeze | grep shelf-reader

docs/_scripts/publication.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Create a new publication specifying the repository_version.
2+
# Alternatively, you can specify the repository, and Pulp will assume the latest version.
3+
export TASK_URL=$(http POST $BASE_ADDR/pulp/api/v3/publications/python/pypi/ \
4+
repository_version=$REPOVERSION_HREF | jq -r '.task')
5+
6+
# Poll the task (here we use a function defined in docs/_scripts/base.sh)
7+
# When the task is complete, it gives us a new Publication
8+
wait_for_pulp $TASK_URL
9+
export PUBLICATION_HREF=${CREATED_RESOURCE[0]}
10+
11+
12+
# Lets inspect our newly created Publication.
13+
http $BASE_ADDR$PUBLICATION_HREF

docs/_scripts/quickstart.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This script will execute the component scripts and ensure that the documented examples
2+
# work as expected.
3+
4+
# THIS SCRIPT CURRENTLY MUST BE RUN IN A PULPLIFT DEVELOPMENT ENVIRONMENT
5+
# TODO: remove the usage of pulp-devel bash functions so they can be directly modified
6+
# for user environments.
7+
8+
# From the _scripts directory, run with `source quickstart.sh` (source to preserve the environment
9+
# variables)
10+
source clean.sh
11+
source base.sh
12+
13+
source repo.sh
14+
source remote.sh
15+
source sync.sh
16+
17+
source publication.sh
18+
source distribution.sh
19+
source pip.sh

docs/_scripts/remote.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Create a remote that syncs some versions of django into your repository.
2+
http POST $BASE_ADDR/pulp/api/v3/remotes/python/python/ \
3+
name='bar' \
4+
url='https://pypi.org/' \
5+
includes:='[{"name": "shelf-reader"}]'
6+
7+
# Export an environment variable for the new remote URI.
8+
export REMOTE_HREF=$(http $BASE_ADDR/pulp/api/v3/remotes/python/python/ | jq -r '.results[] | select(.name == "bar") | ._href')
9+
10+
# Lets inspect our newly created RepositoryVersion.
11+
http $BASE_ADDR$REMOTE_HREF

docs/_scripts/repo.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Start by creating a new repository named "foo":
2+
http POST $BASE_ADDR/pulp/api/v3/repositories/ name=foo
3+
4+
# If you want to copy/paste your way through the guide,
5+
# create an environment variable for the repository URI.
6+
export REPO_HREF=$(http $BASE_ADDR/pulp/api/v3/repositories/ | \
7+
jq -r '.results[] | select(.name == "foo") | ._href')
8+
9+
# Lets inspect our newly created repository.
10+
http $BASE_ADDR$REPO_HREF

docs/_scripts/sync.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Using the Remote we just created, we kick off a sync task
2+
export TASK_URL=$(http POST $BASE_ADDR$REMOTE_HREF'sync/' repository=$REPO_HREF mirror=False \
3+
| jq -r '.task')
4+
5+
# Poll the task (here we use a function defined in docs/_scripts/base.sh)
6+
# When the task is complete, it gives us a new repository version
7+
wait_for_pulp $TASK_URL
8+
export REPOVERSION_HREF=${CREATED_RESOURCE[0]}
9+
10+
# Lets inspect our newly created RepositoryVersion
11+
http $BASE_ADDR$REPOVERSION_HREF

docs/_static/api.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)