Actions
Issue #4814
closedFilter by repository_version not working for artifacts endpoint
Status:
CLOSED - NOTABUG
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:
Description
1 - Populate pulp with artifacts.
Showing current artifacts in Pulp.
[root@p3 ~]# http GET http://localhost:24817/pulp/api/v3/artifacts/
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 69403
Content-Type: application/json
Date: Mon, 06 May 2019 13:45:56 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"count": 250,
"next": "http://localhost:24817/pulp/api/v3/artifacts/?page=2",
"previous": null,
"results": [
{
"_created": "2019-05-06T13:42:27.738384Z",
"_href": "/pulp/api/v3/artifacts/d13902cb-4171-4a6a-bbd8-c08f053bfe5d/",
"file": "artifact/9e/7d6cea5c4bc0e519e0ba6b976365d813c6992ba0681e8ba96edc95a79d9e86",
"md5": "59d032f9a8c73d07d937c98e0a52a796",
"sha1": "211cf51efd6bbc838aabe290d03d06278a6c7c3a",
"sha224": "2f88951344d96754edb2b6f15072c169347dea4852fbe48795c40543",
"sha256": "9e7d6cea5c4bc0e519e0ba6b976365d813c6992ba0681e8ba96edc95a79d9e86",
"sha384": "bf158573e032082f6e54fa41acb8a10d15910f08bade48487df5f60ea76bef00a33f4f1d9ae44c581ebe3bb636208d4b",
"sha512": "4f2feab8456cb9cac431945e82c86816d5ebf32ece981e8324224239ceb253af5c23b19ca8cdba70b72e1c8614e5fc1166f903f32b20d48382ada5d42c9d287e",
"size": 1024
},
...
2 - No repositories are present in pulp.
[root@p3 ~]# http GET http://localhost:24817/pulp/api/v3/repositories/
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 52
Content-Type: application/json
Date: Mon, 06 May 2019 13:47:03 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"count": 0,
"next": null,
"previous": null,
"results": []
}
3 - Sync content to a repository, and inspect repository version.
http POST http://localhost:24817/pulp/api/v3/repositories/ name=foo
export REPO_HREF=$(http :24817/pulp/api/v3/repositories/ | jq -r '.results[] | select(.name == "foo") | ._href')
http POST http://localhost:24817/pulp/api/v3/remotes/file/file/ name='bar' url='https://repos.fedorapeople.org/pulp/pulp/demo_repos/test_file_repo/PULP_MANIFEST'
export REMOTE_HREF=$(http :24817/pulp/api/v3/remotes/file/file/ | jq -r '.results[] | select(.name == "bar") | ._href')
http POST ':24817'$REMOTE_HREF'sync/' repository=$REPO_HREF mirror=True
root@p3 ~]# http GET http://localhost:24817/pulp/api/v3/repositories/
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 390
Content-Type: application/json
Date: Mon, 06 May 2019 13:51:01 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"_created": "2019-05-06T13:47:53.735147Z",
"_href": "/pulp/api/v3/repositories/91bc3a42-5b8c-49de-a7f3-8273f43d7ad4/",
"_latest_version_href": "/pulp/api/v3/repositories/91bc3a42-5b8c-49de-a7f3-8273f43d7ad4/versions/1/",
"_versions_href": "/pulp/api/v3/repositories/91bc3a42-5b8c-49de-a7f3-8273f43d7ad4/versions/",
"description": "",
"name": "foo"
}
]
}
[root@p3 ~]# http GET ':24817'$REPO_HREF'versions/1/'
HTTP/1.1 200 OK
Allow: GET, DELETE, HEAD, OPTIONS
Connection: close
Content-Length: 539
Content-Type: application/json
Date: Mon, 06 May 2019 13:52:24 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"_created": "2019-05-06T13:48:44.647503Z",
"_href": "/pulp/api/v3/repositories/91bc3a42-5b8c-49de-a7f3-8273f43d7ad4/versions/1/",
"base_version": null,
"content_summary": {
"added": {
"file.file": {
"count": 3,
"href": "/pulp/api/v3/content/file/files/?repository_version_added=/pulp/api/v3/repositories/91bc3a42-5b8c-49de-a7f3-8273f43d7ad4/versions/1/"
}
},
"present": {
"file.file": {
"count": 3,
"href": "/pulp/api/v3/content/file/files/?repository_version=/pulp/api/v3/repositories/91bc3a42-5b8c-49de-a7f3-8273f43d7ad4/versions/1/"
}
},
"removed": {}
},
"number": 1
}
4 - Filter artifacts by created repository version.
export REPO_VERSION=$REPO_HREF'versions/1/'
root@p3 ~]# echo $REPO_VERSION
/pulp/api/v3/repositories/91bc3a42-5b8c-49de-a7f3-8273f43d7ad4/versions/1/
[root@p3 ~]# http GET http://localhost:24817/pulp/api/v3/artifacts/ repository_version=$REPO_VERSION
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 69403
Content-Type: application/json
Date: Mon, 06 May 2019 13:56:00 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"count": 253,
"next": "http://localhost:24817/pulp/api/v3/artifacts/?page=2",
"previous": null,
"results": [
{
"_created": "2019-05-06T13:42:27.738384Z",
"_href": "/pulp/api/v3/artifacts/d13902cb-4171-4a6a-bbd8-c08f053bfe5d/",
"file": "artifact/9e/7d6cea5c4bc0e519e0ba6b976365d813c6992ba0681e8ba96edc95a79d9e86",
"md5": "59d032f9a8c73d07d937c98e0a52a796",
"sha1": "211cf51efd6bbc838aabe290d03d06278a6c7c3a",
"sha224": "2f88951344d96754edb2b6f15072c169347dea4852fbe48795c40543",
"sha256": "9e7d6cea5c4bc0e519e0ba6b976365d813c6992ba0681e8ba96edc95a79d9e86",
"sha384": "bf158573e032082f6e54fa41acb8a10d15910f08bade48487df5f60ea76bef00a33f4f1d9ae44c581ebe3bb636208d4b",
"sha512": "4f2feab8456cb9cac431945e82c86816d5ebf32ece981e8324224239ceb253af5c23b19ca8cdba70b72e1c8614e5fc1166f903f32b20d48382ada5d42c9d287e",
"size": 1024
},
...
It was expected to return 3 artifacts, but all artifacts present in pulp were returned.
Pulp 3 installation from source May/13.
(pulp) [root@p3 pulp]# pip list | grep pulpcore
pulpcore 3.0.0rc2
pulpcore-plugin 0.1.0rc2
Related issues
Updated by kersom over 5 years ago
- Related to Story #4806: Provide a repository_version query parameter for the artifacts_list endpoint added
Updated by amacdona@redhat.com over 5 years ago
- Triaged changed from No to Yes
I'd be curious to see if this is the same behavior if we use /?repository_version=href instead of letting httpie construct the querystring parameter. https://httpie.org/doc#querystring-parameters
Updated by dalley over 5 years ago
What Tanya said :) Kersom, please try manually constructing the URL
Updated by kersom over 5 years ago
I will try again, but this issue was found using pulp-smash API client, I just used httpie to filed the issue.
Actions