-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add blacklist, here exclude list, of packages not to install #186
Conversation
Hello @CodeHeeler! Thanks for submitting the PR.
|
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
@CodeHeeler please rebase to latest 3.0-dev Currently if includes isn't set, it defaults to excludes, so the following would actually not sync anything.
I was hoping for something more like:
Which can be done by 1.) creating two separate models, each subclassing ProjectSpecifier: or
and in
Here's an example on how serializer filtering can be done: https://stackoverflow.com/questions/28309507/django-rest-framework-filtering-for-serializer-field This would also necessitate amending the RemoteSerializer |
9a3b4f9
to
d4dbe34
Compare
pulp_python/app/tasks/sync.py
Outdated
else: | ||
for type, digest in package['digests'].items(): | ||
if digests.filter(type=type, digest=digest).exists(): | ||
remote_units.append(parse_metadata(metadata['info'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-indent this across multiple lines as seen elsewhere in the codebase
pulp_python/app/models.py
Outdated
related_query_name="projectspecifier", | ||
on_delete=models.CASCADE | ||
) | ||
remote = models.ForeignKey("PythonRemote", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reindent this to be as it was previously
pulp_python/app/models.py
Outdated
@@ -167,3 +167,9 @@ class PythonRemote(Remote): | |||
""" | |||
|
|||
TYPE = 'python' | |||
|
|||
def includes_specifiers(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be decorated with @property
?
Also please add docstrings
pulp_python/app/tasks/sync.py
Outdated
@@ -56,10 +56,11 @@ def sync(remote_pk, repository_pk): | |||
.format(repository=repository.name, remote=remote.name) | |||
) | |||
|
|||
project_specifiers = python_models.ProjectSpecifier.objects.filter(remote=remote).all() | |||
includes = python_models.ProjectSpecifier.objects.filter(remote=remote, include=True).all() | |||
excludes = python_models.ProjectSpecifier.objects.filter(remote=remote, include=False).all() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the .all()
is necessary here.
pulp_python/app/tasks/sync.py
Outdated
# If neither specifiers nor digests have been set, then we should add the unit | ||
if not project.version_specifier and not digests.exists(): | ||
if project.name in excludes: | ||
whatnottosync=excludes[project.name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whatnottosync
is a little unweildy, maybe call it excluded_pkg
?
Equals sign should have spaces on either side (PEP8).
pulp_python/app/tasks/sync.py
Outdated
""" | ||
Fetch metadata for content units matching project specifiers from the remote. | ||
|
||
Args: | ||
project_specifiers (dict): Information about a project and which versions of a project | ||
to filter | ||
|
||
These units are the difference between the include list and the exclude list. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring needs to be fixed with the new arguments, still lists project_specifiers
.
This one sentence belongs underneath the first one.
See Travis logs for failing PEP8 checks |
fbb5011
to
81c643f
Compare
@CodeHeeler could you rebase on current master? |
dd89b85
to
8441126
Compare
Now packages are not only checked against a whitelist/include list but also against an exclude list when syncing. fixes #3672 https://pulp.plan.io/issues/3672
365624a
to
5845656
Compare
def gen_remote(url=PYTHON_FIXTURES_URL, projects=PYTHON_XS_PROJECT_SPECIFIER, **kwargs): | ||
def gen_remote( | ||
url=PYTHON_FIXTURES_URL, | ||
projects=PYTHON_XS_PROJECT_SPECIFIER, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove projects
here and below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and do a search to replace gen_remote(.., projects=..)
with gen_remote(.., includes=..)
This reverts commit 0ff205a.
There will also need to be some documentation updates to cover the new names. Preferably an example of using Excludes in practice, but at minimum changing e.g. "projects" to "includes" so that the existing examples will still work. If during the process of testing this you also feel like changing the example urls from the old UUID form to the new integer ID form, that would also be appreciated :) but you don't have to. |
Cool, thanks for pointing that out! |
Going to remake this PR on top of the Declarative Version changes, once those are merged. |
No description provided.