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

Fixes #36538 - Don't delete manifests referenced by tags or manifest lists #10711

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/lib/actions/katello/repository/remove_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def plan(repository, content_units, options = {})
unless repository.content_view.default?
fail _("Can only remove content from within the Default Content View")
end

content_units = valid_docker_manifests_to_delete!(content_units) if (repository.docker? && content_units.first.class::CONTENT_TYPE == 'docker_manifest')
action_subject(repository)

content_unit_ids = content_units.map(&:id)
Expand Down Expand Up @@ -58,6 +58,14 @@ def finalize
end
end

def valid_docker_manifests_to_delete!(content_units)
original_content_units = content_units
content_units = content_units.reject { |dm| dm.docker_tags.count > 0 || dm.docker_manifest_lists.count > 0 }
Rails.logger.warn("Docker Manifests with tags or manifest lists will be ignored; continuing...") if original_content_units.count != content_units.count
fail _("No docker manifests to delete after ignoring manifests with tags or manifest lists") if content_units.count == 0
content_units
end

def humanized_name
_("Remove Content")
end
Expand Down
Loading