Class: Actions::Katello::CapsuleContent::RemoveUnneededRepos

Inherits:
Base
  • Object
show all
Defined in:
app/lib/actions/katello/capsule_content/remove_unneeded_repos.rb

Instance Method Summary collapse

Instance Method Details

#plan(capsule_content) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/lib/actions/katello/capsule_content/remove_unneeded_repos.rb', line 5

def plan(capsule_content)
  currently_on_capsule = capsule_content.current_repositories.map(&:pulp_id)
  needed_on_capsule = capsule_content.repos_available_to_capsule.map(&:pulp_id)

  need_removal = currently_on_capsule - needed_on_capsule
  need_removal += capsule_content.orphaned_repos
  need_removal.each do |pulp_id|
    plan_action(Pulp::Repository::Destroy,
                :pulp_id => pulp_id,
                :capsule_id => capsule_content.capsule.id)
  end
end