Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT pulp_labels POC #5787

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

DRAFT pulp_labels POC #5787

wants to merge 1 commit into from

Conversation

ggainey
Copy link
Contributor

@ggainey ggainey commented Sep 11, 2024

No description provided.

@ggainey
Copy link
Contributor Author

ggainey commented Sep 11, 2024

Note that RBAC support for set/unset-labels requires work in the plugins - see the pulp_file commit.

Current issues:

  • upload file needs multipart, pulp_labels needs JSON dict, and DRF is Sad about tat combination
  • tests
  • search-by-label-and-repo(s)
  • remove-by-label-and-repo(s)

Comment on lines -447 to +449
"You may also specify '*' as an entry to remove all content. This content is "
"removed before add_content_units are added."
"You may specify '*' as an entry to remove all content, or 'key=value' pairs "
"to remove content by-label. This content is removed before add_content_units "
"are added."
Copy link
Member

@mdellweg mdellweg Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I can see, that this is still unambiguous. But should we maybe go for a new remove_q field?
You may for example remove all files from a repository by their relative_path__startswith...
So the logic could start with remove_q="pulp_label_select='foo'" and later we add support for remove_q="pulp_label_select='foo' OR relative_path__startswith='/bar/'.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having said that, should we factor this part (advanced modify) into it's own PR? It would give us time to think this high level api design over.

Given that a user can filter content by labels, they can already compile the set of content hrefs locally to call modify with them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that a user can filter content by labels, they can already compile the set of content hrefs locally to call modify with them.

Yes - but the user-experience of calling an API with a list of possibly thousands of HREFs, for one label, is...suboptimal. And "remove all the units with a given build id" is the actual requirement we're being asked to respond to, it's the point for doing this at all.

I can see benefits to a more-general Q filter - but I'm not sure the extra flexibility is worth the extra complication?

Comment on lines +486 to +488
# Current: multiple labels, mixed with hrefs, only '='
# "x=y" can happen multiple times, and means "all content with label x=y, pass k=v pair"
labels_specified = [s for s in value if "=" in s]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically you can have a label that is just a key, with no value. So we probably should assume anything that doesn't begin with a slash to be a proper label.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooof, good point. Pushes us towards @mdellweg 's comment above, to have a remove_q=... construct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants