Class: Actions::Katello::Environment::Destroy

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

Instance Method Summary collapse

Instance Method Details

#finalizeObject



39
40
41
42
# File 'app/lib/actions/katello/environment/destroy.rb', line 39

def finalize
  environment = ::Katello::KTEnvironment.find(input['kt_environment']['id'])
  environment.destroy!
end

#humanized_inputObject



35
36
37
# File 'app/lib/actions/katello/environment/destroy.rb', line 35

def humanized_input
  ["'#{input['kt_environment']['name']}'"] + super
end

#humanized_nameObject



31
32
33
# File 'app/lib/actions/katello/environment/destroy.rb', line 31

def humanized_name
  _("Delete Lifecycle Environment")
end

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



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/lib/actions/katello/environment/destroy.rb', line 12

def plan(env, options = {})
  unless env.deletable?
    fail env.errors.full_messages.join(" ")
  end
  skip_repo_destroy = options.fetch(:skip_repo_destroy, false)
  organization_destroy = options.fetch(:organization_destroy, false)
  sequence do
    action_subject(env)

    concurrence do
      env.content_view_environments.each do |cve|
        plan_action(ContentView::Remove, cve.content_view, :content_view_environments => [cve], :skip_repo_destroy => skip_repo_destroy, :organization_destroy => organization_destroy)
      end
    end

    plan_self
  end
end