Skip to content

Commit

Permalink
WIP: Set is_highest based on synlist.policy
Browse files Browse the repository at this point in the history
Issue: AAH-585
  • Loading branch information
alikins committed Jun 10, 2021
1 parent f8747a6 commit f9c7a5d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions galaxy_ng/app/tasks/synclist.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,27 @@ def curate_synclist_repository(synclist_pk, **kwargs):

namespaces = synclist.namespaces.filter().values_list("name", flat=True)

# FIXME: For 'exclude', probably need to remove the is_highest
# FIXME: For 'exclude', we want to remove all version of the excluded collection
is_highest = True
if synclist.policy == 'exclude':
is_highest = False

collection_versions = CollectionVersion.objects.filter(
Q(
repositories=synclist.upstream_repository,
collection__namespace__in=namespaces,
is_highest=True,
is_highest=is_highest,
)
| Q(
collection__in=synclist.collections.all(),
repositories=synclist.repository,
is_highest=True,
is_highest=is_highest,
)
)

import pprint
log.debug('collection_versions: %s', pprint.pformat(collection_versions.all()))

if synclist.policy == "exclude":
task_kwargs = {
"base_version_pk": str(latest_upstream.pulp_id),
Expand All @@ -156,4 +163,5 @@ def curate_synclist_repository(synclist_pk, **kwargs):
else:
raise RuntimeError("Unexpected synclist policy {}".format(synclist.policy))

log.debug('task_kwargs: %s', pprint.pformat(task_kwargs))
add_and_remove(**task_kwargs)

0 comments on commit f9c7a5d

Please sign in to comment.