Skip to content

Errors trying to label a repository with valid chars #1165

@git-hyagi

Description

@git-hyagi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Triage-NeededNeeds to be reviewed at next pulp-cli mtgbugSomething isn't working (template-set)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions