Errors trying to label a repository with valid chars
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 43
- Forks
- 52
- Avg merge
- 11h 38m
- Merged PRs (30d)
- 11
Description
Summary
Strange behavior in 'label set' command:
$ pulp python repository label set --key 'osv-dev ecosystem' --value 'test' --repository test-python
Error: {"key":["Enter a valid \"slug\" consisting of letters, numbers, underscores or hyphens."]}
$ pulp python repository label set --key 'osv_dev ecosystem' --value 'test' --repository test-python
Error: {"key":["Enter a valid \"slug\" consisting of letters, numbers, underscores or hyphens."]}
- I think pulp_labels_validator serializer considers space as valid, but this still failed:
$ pulp python repository label set --key 'osv dev ecosystem' --value 'test' --repository test-python
Error: {"key":["Enter a valid \"slug\" consisting of letters, numbers, underscores or hyphens."]}
- not sure how this passed the
pulp_labels_validatorserializer:
$ pulp python repository label set --key 'osv_dev-ecosystem' --value 'test' --repository test-python
$ pulp python repository show --name test-python |jq .pulp_labels
{
"osv_dev-ecosystem": "test"
}
Additonal context
From pulpcore code, it seems like space and underscore are allowed, but hyphens are not:
https://github.com/pulp/pulpcore/blob/9b6c47ffa88377de814c47c2ceb0cf819cf6f288/pulpcore/app/serializers/fields.py#L430
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the three pulp python repository label set examples and compare their behavior with the pulpcore serializer at pulpcore/app/serializers/fields.py around line 430. Trace how the CLI sends the label key, then make validation consistently accept or reject the documented characters and verify the three cases behave as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100