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

Use *Unit classes as templates in search criteria #64

Open
rbikar opened this issue Sep 30, 2019 · 0 comments
Open

Use *Unit classes as templates in search criteria #64

rbikar opened this issue Sep 30, 2019 · 0 comments

Comments

@rbikar
Copy link
Member

rbikar commented Sep 30, 2019

Summary

To avoid using raw dicts searching in Pulp we could use *Unit classes as templates in search criteria.
So we can introduce a class method Criteria.for_units() that will accept list of units for which criteria should be created, unset fields in unit instance will be interpreted as "match any value for this field"
E.g. we can do this for copying or removing or searching units:

unit = RpmUnit(name='bash')
crit = Criteria.for_units([unit])
# This kind of criteria can be used in
# various APIs like:
# copy all bash from repo1 to repo2
repo1.copy_content(criteria=crit, to_repo=repo2)
# remove all bash RPMs
repo1.remove_content(criteria=crit)
# search all bash RPMs
repo1.search_content(criteria=crit)

This should copy all RPMs named "bash" from one repo to another, or it should search in similar manner.

Issue Type

  • Feature Request

Current behavior

Currently creation Criteria instance for units is no much convenient.

Desired behavior

  • Lib supports creation of criteria with *Unit classes used as templates (Criteria.for_units([unit1, unit2]))
  • Unset filed in unit are interpreted as match any value for this field
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

No branches or pull requests

1 participant