Revision 58e2ca06
Added by David Davis almost 10 years ago
app/lib/actions/katello/content_view_environment/destroy.rb | ||
---|---|---|
module ContentViewEnvironment
|
||
class Destroy < Actions::Base
|
||
|
||
def plan(cv_env)
|
||
def plan(cv_env, options = {})
|
||
skip_cp_update = options.fetch(:skip_candlepin_update, false)
|
||
content_view = cv_env.content_view
|
||
environment = cv_env.environment
|
||
content_view.check_remove_from_environment!(environment)
|
||
... | ... | |
plan_action(ContentViewPuppetEnvironment::Destroy, puppet_env)
|
||
end
|
||
end
|
||
plan_action(Candlepin::Environment::Destroy, cp_id: cv_env.cp_id)
|
||
plan_action(Candlepin::Environment::Destroy, cp_id: cv_env.cp_id) unless skip_cp_update
|
||
|
||
cv_env.reload
|
||
cv_env.destroy
|
||
cv_env.destroy!
|
||
end
|
||
end
|
||
|
app/lib/actions/katello/organization/destroy.rb | ||
---|---|---|
end
|
||
|
||
def remove_content_view_environment(cv_env)
|
||
content_view = cv_env.content_view
|
||
environment = cv_env.environment
|
||
|
||
concurrence do
|
||
content_view.repos(environment).each do |repo|
|
||
plan_action(Repository::Destroy, repo, skip_environment_update: true)
|
||
end
|
||
|
||
if puppet_env = content_view.puppet_env(environment)
|
||
plan_action(ContentViewPuppetEnvironment::Destroy, puppet_env)
|
||
end
|
||
end
|
||
|
||
cv_env.reload
|
||
cv_env.destroy!
|
||
plan_action(ContentViewEnvironment::Destroy, cv_env, skip_candlepin_update: true)
|
||
end
|
||
|
||
def remove_content_views(organization)
|
Also available in: Unified diff
Fixes #6985,BZ1127747 - Reusing CVEnv action in org destroy
Reusing the ContentViewEnvironment::Destroy action in Organization::Destroy
since the action was updated without Organization::Destroy being also updated.
This'll ensure future updates won't break org destroy.