Closed ipanova closed 7 months ago
This was supposedly fixed in django 4.0: https://code.djangoproject.com/ticket/30581.
@ipanova, can you verify whether this bug still persists in django 4.2?
The issue still persists:
In [1]: m=Manifest.objects.first()
In [2]: m.media_type
Out[2]: 'application/vnd.docker.distribution.manifest.list.v2+json'
In [3]: m.media_type = "lalala"
In [4]: m.save()
In [5]:
Do you really want to exit ([y]/n)?
[root@751098a6e335 /]# exit
[lmjachky@localhost oci_env]$ http :5001/pulp/api/v3/content/container/manifests/
HTTP/1.1 200 OK
Access-Control-Expose-Headers: Correlation-ID
Allow: GET, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 9079
Content-Type: application/json
Correlation-ID: cd05143a86ed4203a5a6273704d93e8e
Cross-Origin-Opener-Policy: same-origin
Date: Thu, 20 Jul 2023 10:07:36 GMT
Referrer-Policy: same-origin
Server: nginx/1.14.1
Vary: Accept
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
{
"count": 13,
"next": null,
"previous": null,
"results": [
{
"artifact": "/pulp/api/v3/artifacts/018972c3-0d65-7142-af1d-3ade0e0cc29e/",
"blobs": [],
"config_blob": null,
"digest": "sha256:2eeacd9391c1380f8613788b185d2196702f3042c30b8d74aa1ce26b24ed60b1",
"listed_manifests": [
"/pulp/api/v3/content/container/manifests/018972c3-0eb5-7e7e-84d1-b3568b18dbec/",
"/pulp/api/v3/content/container/manifests/018972c3-0ed4-7312-bfdb-3fa8572f0dfb/",
"/pulp/api/v3/content/container/manifests/018972c3-0edb-7bd9-8824-557d696626af/",
"/pulp/api/v3/content/container/manifests/018972c3-0f43-7617-b7b3-7eee18678952/",
"/pulp/api/v3/content/container/manifests/018972c3-0ecb-7d0a-876a-4de9d465a72e/",
"/pulp/api/v3/content/container/manifests/018972c3-0e69-7309-8105-60d522784135/",
"/pulp/api/v3/content/container/manifests/018972c3-0ebf-776d-b3b5-9c689cc67d49/",
"/pulp/api/v3/content/container/manifests/018972c3-0ec6-73ea-97c5-df14df7ae900/",
"/pulp/api/v3/content/container/manifests/018972c3-0e9c-71c6-b96d-1ea560c1c116/"
],
"media_type": "application/vnd.docker.distribution.manifest.list.v2+json",
"pulp_created": "2023-07-20T10:05:35.726457Z",
"pulp_href": "/pulp/api/v3/content/container/manifests/018972c3-0f75-7cb7-8b45-ab14141e677a/",
"schema_version": 2
},
{
"artifact": "/pulp/api/v3/artifacts/018972c3-0d56-7849-a30c-76bed9b1a4c1/",
"blobs": [],
"config_blob": null,
"digest": "sha256:8a2bd13f5d1cbc36c2a0a5ee2fdc544b5320c2393768a3e9b96b476c8faeab68",
"listed_manifests": [
"/pulp/api/v3/content/container/manifests/018972c3-0e69-7309-8105-60d522784135/",
"/pulp/api/v3/content/container/manifests/018972c3-0e87-7110-9b12-9f8c6336c484/",
"/pulp/api/v3/content/container/manifests/018972c3-0e9c-71c6-b96d-1ea560c1c116/",
"/pulp/api/v3/content/container/manifests/018972c3-0ea4-7a44-9283-8fe37fb6ae7d/",
"/pulp/api/v3/content/container/manifests/018972c3-0eb5-7e7e-84d1-b3568b18dbec/",
"/pulp/api/v3/content/container/manifests/018972c3-0ebf-776d-b3b5-9c689cc67d49/",
"/pulp/api/v3/content/container/manifests/018972c3-0ec6-73ea-97c5-df14df7ae900/",
"/pulp/api/v3/content/container/manifests/018972c3-0ecb-7d0a-876a-4de9d465a72e/",
"/pulp/api/v3/content/container/manifests/018972c3-0ed4-7312-bfdb-3fa8572f0dfb/",
"/pulp/api/v3/content/container/manifests/018972c3-0edb-7bd9-8824-557d696626af/",
"/pulp/api/v3/content/container/manifests/018972c3-0f43-7617-b7b3-7eee18678952/"
],
"media_type": "lalala", <---------------------------- HERE
"pulp_created": "2023-07-20T10:05:35.685490Z",
"pulp_href": "/pulp/api/v3/content/container/manifests/018972c3-0daa-7f97-995f-5259923c3f3d/",
"schema_version": 2
},
A fix to this issue was proposed in a PR: https://github.com/pulp/pulp_container/pull/1527 , but in the end, we decided to close the issue in favor of point 4 here: https://github.com/pulp/pulp_container/issues/1494 . There is no point in DB-level validation if we plan to disable the app-level validation for media_type.
https://github.com/pulp/pulp_container/blob/main/pulp_container/app/models.py#L84