5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/lib/actions/katello/content_view_environment/destroy.rb', line 5
def plan(cv_env, options = {})
skip_cp_update = options.fetch(:skip_candlepin_update, false)
skip_repo_destroy = options.fetch(:skip_repo_destroy, false)
organization_destroy = options.fetch(:organization_destroy, false)
content_view = cv_env.content_view
environment = cv_env.environment
content_view.check_remove_from_environment!(environment) unless organization_destroy
sequence do
concurrence do
unless skip_repo_destroy
content_view.repos(environment).each do |repo|
plan_action(Repository::Destroy, repo, skip_environment_update: true, :planned_destroy => true)
end
end
if puppet_env = content_view.puppet_env(environment)
plan_action(Actions::Foreman::Environment::Destroy, puppet_env.puppet_environment) if puppet_env.puppet_environment
plan_action(ContentViewPuppetEnvironment::Destroy, puppet_env) unless organization_destroy
end
end
plan_action(Candlepin::Environment::Destroy, cp_id: cv_env.cp_id) unless skip_cp_update
plan_self(:id => cv_env.id)
end
end
|