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

Implement automatic cleanup when pull-through caching fails or its main distribution is removed #1683

Open
lubosmj opened this issue Jul 1, 2024 · 1 comment
Labels

Comments

@lubosmj
Copy link
Member

lubosmj commented Jul 1, 2024

At the moment, when the pulling fails in the middle of the execution, we may end up having some left-overs in the database. Similarly, when a user decides to remove a pull-through caching distribution, we should give her a way to remove everything, including created sub-distributions, remotes, and repositories.

@lubosmj lubosmj added the Task label Jul 1, 2024
@lubosmj lubosmj moved this from Not Started to Todo in Pulp Container Roadmap Jul 1, 2024
@lubosmj lubosmj added Feature and removed Task labels Jul 3, 2024
@lubosmj
Copy link
Member Author

lubosmj commented Jul 4, 2024

Once this block succeeds:

with transaction.atomic():
repository, _ = models.ContainerRepository.objects.get_or_create(
name=path, retain_repo_versions=1
)
remote_data = _get_pull_through_remote_data(pull_through_cache_distribution)
upstream_name = path.split(pull_through_cache_distribution.base_path, maxsplit=1)[1]
remote, _ = models.ContainerRemote.objects.get_or_create(
name=path,
upstream_name=upstream_name.strip("/"),
url=pull_through_cache_distribution.remote.url,
**remote_data,
)
# TODO: Propagate the user's permissions and private flag from the pull-through
# distribution to this distribution
distribution, _ = models.ContainerDistribution.objects.get_or_create(
name=path,
base_path=path,
remote=remote,
repository=repository,
)

we can end up having an orphaned repository-remote-distribution triplet if the actual remote repository is not reachable. Perhaps, we should first try to ping the remote repository to verify whether it is available or not.

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

No branches or pull requests

1 participant