Skip to content

Commit

Permalink
Fixes #36538 - Don't delete manifests referenced by tags or manifest …
Browse files Browse the repository at this point in the history
…lists (#10711)

(cherry picked from commit cfc586c)
  • Loading branch information
sjha4 authored and damoore044 committed Sep 20, 2023
1 parent d920c1e commit cb9a2dc
Showing 1 changed file with 9 additions and 1 deletion.
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

0 comments on commit cb9a2dc

Please sign in to comment.