Class: Actions::Katello::ContentView::Destroy

Inherits:
EntryAction
  • Object
show all
Defined in:
app/lib/actions/katello/content_view/destroy.rb

Instance Method Summary collapse

Instance Method Details

#finalizeObject



27
28
29
30
31
32
# File 'app/lib/actions/katello/content_view/destroy.rb', line 27

def finalize
  content_view = ::Katello::ContentView.where(id: input[:content_view][:id]).first
  return if content_view.blank?
  content_view.content_view_repositories.each(&:destroy)
  content_view.destroy!
end

#humanized_nameObject



34
35
36
# File 'app/lib/actions/katello/content_view/destroy.rb', line 34

def humanized_name
  _("Delete")
end

#plan(content_view, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/lib/actions/katello/content_view/destroy.rb', line 7

def plan(content_view, options = {})
  action_subject(content_view)
  if options.fetch(:check_ready_to_destroy, true)
    content_view.check_ready_to_destroy!
  end

  sequence do
    concurrence do
      content_view.content_view_versions.each do |version|
        plan_action(ContentViewVersion::Destroy, version, options)
      end
    end

    if SmartProxy.pulp_primary&.pulp3_enabled?
      plan_action(Actions::Pulp3::ContentView::DeleteRepositoryReferences, content_view, SmartProxy.pulp_primary)
    end
    plan_self
  end
end