|
1 | 1 | Upload and Manage Content |
2 | 2 | ========================= |
| 3 | +Content can be added to a repository not only by synchronizing from a remote source but also by uploading the files directly into Pulp. |
3 | 4 |
|
4 | 5 | Create a repository |
5 | 6 | ------------------- |
6 | 7 |
|
7 | | -If you don't already have a repository, create one:: |
| 8 | +If you don't already have a repository, create one. |
8 | 9 |
|
9 | | - $ http POST $BASE_ADDR/pulp/api/v3/repositories/python/python/ name=foo |
| 10 | +.. literalinclude:: ../_scripts/repo.sh |
| 11 | + :language: bash |
10 | 12 |
|
11 | | -Response:: |
| 13 | +Repository GET response:: |
12 | 14 |
|
13 | 15 | { |
14 | | - "pulp_href": "http://localhost:24817/pulp/api/v3/repositories/python/python/9b19ceb7-11e1-4309-9f97-bcbab2ae38b6/", |
15 | | - ... |
| 16 | + "description": null, |
| 17 | + "latest_version_href": "/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/0/", |
| 18 | + "name": "foo", |
| 19 | + "pulp_created": "2020-05-28T20:15:08.644358Z", |
| 20 | + "pulp_href": "/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/", |
| 21 | + "versions_href": "/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/" |
16 | 22 | } |
17 | 23 |
|
18 | 24 |
|
| 25 | + |
19 | 26 | Upload a file to Pulp |
20 | 27 | --------------------- |
21 | 28 |
|
22 | | -Each artifact in Pulp represents a file. They can be created during sync or created manually by uploading a file:: |
| 29 | +Each artifact in Pulp represents a file. They can be created during sync or created manually by uploading a file. |
23 | 30 |
|
24 | | - $ http --form POST $BASE_ADDR/pulp/api/v3/artifacts/ file@./my_content |
| 31 | +.. literalinclude:: ../_scripts/artifact.sh |
| 32 | + :language: bash |
25 | 33 |
|
26 | | -Response:: |
| 34 | +Artifact GET response:: |
27 | 35 |
|
28 | 36 | { |
29 | | - "pulp_href": "http://localhost:24817/pulp/api/v3/artifacts/6f847a21-a177-4a49-ad47-86f415b3830d/", |
30 | | - ... |
| 37 | + "file": "artifact/04/cfd8bb4f843e35d51bfdef2035109bdea831b55a57c3e6a154d14be116398c", |
| 38 | + "md5": "2dac570a33d88ca224be86759be59376", |
| 39 | + "pulp_created": "2020-05-28T20:21:23.441981Z", |
| 40 | + "pulp_href": "/pulp/api/v3/artifacts/f87a20b0-d5b9-4a07-9282-bf7f9e5eb37f/", |
| 41 | + "sha1": "bf039b185ef1f308e7d0bc5322be10061ca4f695", |
| 42 | + "sha224": "01c8a673b13875cb12deb0e9fb2fddf3579583d7837b4458a78dd83c", |
| 43 | + "sha256": "04cfd8bb4f843e35d51bfdef2035109bdea831b55a57c3e6a154d14be116398c", |
| 44 | + "sha384": "4c22ded8001904b4fedb3fa974c883479fb32d630ceb48d7455bfd390166afd73cfda5b4c9c0c8d3a19bb67966ae13d0", |
| 45 | + "sha512": "4d11d6a67ec6aa3eb25df2416b6d48f1c6c04d5e745b12d7dbc89aacfc8bcb439c5ccff56324ce8493099e4e2f79a414d2513758782efcaef84b3d8cf00ea45f", |
| 46 | + "size": 19097 |
31 | 47 | } |
32 | 48 |
|
33 | 49 |
|
34 | 50 | Create content from an artifact |
35 | 51 | ------------------------------- |
36 | 52 |
|
37 | | -Now that Pulp has the content, its time to make it into a unit of content. |
| 53 | +Now that Pulp has the package, its time to make it into a unit of content. |
38 | 54 |
|
39 | | - $ http POST $BASE_ADDR/pulp/api/v3/content/python/ artifact=http://localhost:24817/pulp/api/v3/artifacts/6f847a21-a177-4a49-ad47-86f415b3830d/ filename=my_content |
| 55 | +.. literalinclude:: ../_scripts/package.sh |
| 56 | + :language: bash |
40 | 57 |
|
41 | | -Response:: |
| 58 | +Content GET response:: |
42 | 59 |
|
43 | 60 | { |
44 | | - "pulp_href": "http://localhost:24817/pulp/api/v3/content/python/python/ae016be0-0499-4547-881f-c56a1d0186a6/", |
45 | | - "_artifact": "http://localhost:24817/pulp/api/v3/artifacts/6f847a21-a177-4a49-ad47-86f415b3830d/", |
46 | | - "digest": "b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c", |
47 | | - "filename": "my-content", |
| 61 | + "artifact": "/pulp/api/v3/artifacts/f87a20b0-d5b9-4a07-9282-bf7f9e5eb37f/", |
| 62 | + "author": "Austin Macdonald", |
| 63 | + "author_email": "asmacdo@gmail.com", |
| 64 | + "classifiers": [], |
| 65 | + "description": "too long to read", |
| 66 | + "download_url": "", |
| 67 | + "filename": "shelf-reader-0.1.tar.gz", |
| 68 | + "home_page": "https://github.com/asmacdo/shelf-reader", |
| 69 | + "keywords": "", |
| 70 | + "license": "GNU GENERAL PUBLIC LICENSE Version 2, June 1991", |
| 71 | + "maintainer": "", |
| 72 | + "maintainer_email": "", |
| 73 | + "metadata_version": "1.1", |
| 74 | + "name": "shelf-reader", |
| 75 | + "obsoletes_dist": "[]", |
| 76 | + "packagetype": "sdist", |
| 77 | + "platform": "", |
| 78 | + "project_url": "", |
| 79 | + "provides_dist": "[]", |
| 80 | + "pulp_created": "2020-05-28T20:49:12.156807Z", |
| 81 | + "pulp_href": "/pulp/api/v3/content/python/packages/2ac13c48-0f45-4811-80d2-5dcbb7821ce1/", |
| 82 | + "requires_dist": "[]", |
| 83 | + "requires_external": "[]", |
| 84 | + "requires_python": "", |
| 85 | + "summary": "Make sure your collections are in call number order.", |
| 86 | + "supported_platform": "", |
| 87 | + "version": "0.1" |
48 | 88 | } |
49 | 89 |
|
| 90 | + |
50 | 91 | Add content to a repository |
51 | 92 | --------------------------- |
52 | 93 |
|
53 | | -Once there is a content unit, it can be added and removed and from to repositories:: |
| 94 | +Once there is a content unit, it can be added and removed from repositories using add_content_units or remove_content_units respectively. |
| 95 | + |
| 96 | +.. literalinclude:: ../_scripts/add_content_repo.sh |
| 97 | + :language: bash |
54 | 98 |
|
55 | | -$ http POST $REPO_HREF/pulp/api/v3/repositories/python/python/9b19ceb7-11e1-4309-9f97-bcbab2ae38b6/modify/ add_content_units:="[\"http://localhost:24817/pulp/api/v3/content/python/python/ae016be0-0499-4547-881f-c56a1d0186a6/\"]" |
| 99 | +Repository Version GET response (after task complete):: |
| 100 | + |
| 101 | + { |
| 102 | + "base_version": null, |
| 103 | + "content_summary": { |
| 104 | + "added": { |
| 105 | + "python.python": { |
| 106 | + "count": 1, |
| 107 | + "href": "/pulp/api/v3/content/python/packages/?repository_version_added=/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/1/" |
| 108 | + } |
| 109 | + }, |
| 110 | + "present": { |
| 111 | + "python.python": { |
| 112 | + "count": 1, |
| 113 | + "href": "/pulp/api/v3/content/python/packages/?repository_version=/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/1/" |
| 114 | + } |
| 115 | + }, |
| 116 | + "removed": {} |
| 117 | + }, |
| 118 | + "number": 1, |
| 119 | + "pulp_created": "2020-05-28T21:04:54.403979Z", |
| 120 | + "pulp_href": "/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/1/" |
| 121 | + } |
0 commit comments