Project

Profile

Help

Issue #8899

closed

IntegerFields cannot be set null after being set to a value even if allow_null=True

Added by dalley over 1 year ago. Updated over 1 year ago.

Status:
CLOSED - NOTABUG
Priority:
High
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
3. High
Version:
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

The serializer rejects non-integer inputs even if allow_null = True.

(pulp) [vagrant@pulp3-source-fedora33 ~]$ http PATCH :24817/pulp/api/v3/repositories/file/file/85f819ba-4905-47f2-99eb-c35ec231743c/ retained_versions=null
HTTP/1.1 400 Bad Request
Access-Control-Expose-Headers: Correlation-ID
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Connection: close
Content-Length: 54
Content-Type: application/json
Correlation-ID: 0b3509ee731a453fa2666c51cef5001a
Date: Tue, 15 Jun 2021 22:49:24 GMT
Server: gunicorn
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "retained_versions": [
        "A valid integer is required."
    ]
}


"retained_versions" and "rate_limit" both suffer from this problem, and "download_concurrency" and "retry_count" will suffer from it once merged.

This might be a Django Rest Framework problem.


Related issues

Blocks Pulp - Story #8881: As a user, Pulp will retry downloads by default 3 times and I can configure this value on my RemoteCLOSED - CURRENTRELEASEdalley

Actions
Actions #1

Updated by dalley over 1 year ago

  • Subject changed from Nullable IntegerFields cannot be set null after being set to a value to IntegerFields cannot be set null after being set to a value even if allow_null=True
  • Description updated (diff)
Actions #2

Updated by dalley over 1 year ago

  • Blocks Story #8881: As a user, Pulp will retry downloads by default 3 times and I can configure this value on my Remote added
Actions #4

Updated by daviddavis over 1 year ago

I believe this sets retained_versions to the string "null":

http PATCH :24817/pulp/api/v3/repositories/file/file/85f819ba-4905-47f2-99eb-c35ec231743c/ retained_versions=null

This works for me:

http PATCH :24817/pulp/api/v3/repositories/file/file/85f819ba-4905-47f2-99eb-c35ec231743c/ retained_versions:=null
Actions #5

Updated by dalley over 1 year ago

  • Status changed from NEW to CLOSED - NOTABUG

Thanks David. This is still a problem, but likely with the CLI.

(pulp) [vagrant@pulp3-source-fedora33 pulpcore]$ pulp file repository update --name=test --retained-versions=null
Error: {"retained_versions":["A valid integer is required."]}

But you're right that emptystring works

(pulp) [vagrant@pulp3-source-fedora33 pulpcore]$ pulp file repository update --name=test --retained-versions=''
Started background task /pulp/api/v3/tasks/e8f6ae86-9c01-48ef-b1c5-444441d78aee/
.Done.
(pulp) [vagrant@pulp3-source-fedora33 pulpcore]$ pulp file repository show --name=test
{
  "pulp_href": "/pulp/api/v3/repositories/file/file/7751287a-80bc-4c44-a584-477dc4757148/",
  "pulp_created": "2021-06-16T15:12:26.373420Z",
  "versions_href": "/pulp/api/v3/repositories/file/file/7751287a-80bc-4c44-a584-477dc4757148/versions/",
  "pulp_labels": {},
  "latest_version_href": "/pulp/api/v3/repositories/file/file/7751287a-80bc-4c44-a584-477dc4757148/versions/0/",
  "name": "test",
  "description": null,
  "retained_versions": null,
  "remote": null,
  "autopublish": false,
  "manifest": "PULP_MANIFEST"
}

Also available in: Atom PDF