Errors trying to label a repository with valid chars

Open
#1,165 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli

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.

Description

bug

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_validator serializer:
$ 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

Dominant language
Python
Stars
43
Forks
52
Avg merge
11h 38m
Merged PRs (30d)
11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pulp/pulp-cli

All issues in pulp/pulp-cli

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.