Class: Actions::Katello::Repository::Destroy
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::Repository::Destroy
- Defined in:
- app/lib/actions/katello/repository/destroy.rb
Instance Method Summary collapse
- #finalize ⇒ Object
- #humanized_name ⇒ Object
-
#plan(repository, options = {}) ⇒ Object
options: skip_environment_update - defaults to false.
Instance Method Details
#finalize ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'app/lib/actions/katello/repository/destroy.rb', line 40 def finalize unless input[:planned_destroy] ::User.current = ::User.find(input[:user_id]) repository = ::Katello::Repository.find(input[:repository][:id]) repository.destroy! end ensure ::User.current = nil end |
#humanized_name ⇒ Object
50 51 52 |
# File 'app/lib/actions/katello/repository/destroy.rb', line 50 def humanized_name _("Delete") end |
#plan(repository, options = {}) ⇒ Object
options:
skip_environment_update - defaults to false. skips updating the CP environment
planned_destroy - default to false. destroy the AR object in plan phase instead of finalize
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/lib/actions/katello/repository/destroy.rb', line 10 def plan(repository, = {}) planned_destroy = .fetch(:planned_destroy, false) skip_environment_update = .fetch(:skip_environment_update, false) || .fetch(:organization_destroy, false) action_subject(repository) if !planned_destroy && !repository.assert_deletable # The repository is going to be deleted in finalize, but it cannot be deleted. # Stop now and inform the user. fail repository.errors..values.join("\n") end plan_action(ContentViewPuppetModule::Destroy, repository) if repository.puppet? plan_action(Pulp::Repository::Destroy, pulp_id: repository.pulp_id) sequence do plan_action(Product::ContentDestroy, repository) plan_action(Repository::DestroyMedium, repository) view_env = repository.content_view.content_view_environment(repository.environment) repository.destroy! if planned_destroy if !skip_environment_update && ::SETTINGS[:katello][:use_cp] && view_env plan_action(ContentView::UpdateEnvironment, repository.content_view, repository.environment) end end plan_self(:user_id => ::User.current.id, :planned_destroy => planned_destroy) end |