Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #26821 - move cp owner delete to finalize phase #8185

Merged
merged 1 commit into from Jul 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/lib/actions/candlepin/owner/destroy.rb
Expand Up @@ -6,7 +6,7 @@ class Destroy < Candlepin::Abstract
param :label
end

def run
def finalize
output[:response] = ::Katello::Resources::Candlepin::Owner.destroy(input[:label])
end
end
Expand Down
11 changes: 0 additions & 11 deletions app/lib/actions/katello/organization/destroy.rb
Expand Up @@ -16,7 +16,6 @@ def plan(organization, current_org = nil)
remove_products(organization)
remove_providers(organization)
remove_environments(organization)
destroy_contents(organization)
plan_self
plan_action(Candlepin::Owner::Destroy, label: organization.label) if ::SETTINGS[:katello][:use_cp]
end
Expand Down Expand Up @@ -91,16 +90,6 @@ def remove_default_content_view(organization)
plan_action(ContentView::Destroy, organization.default_content_view, :check_ready_to_destroy => false, :organization_destroy => true)
end
end

def destroy_contents(organization)
repositories = organization.products.map(&:repositories).flatten
content_ids = repositories.map(&:content_id).uniq
content_ids.each do |content_id|
plan_action(Candlepin::Product::ContentDestroy,
owner: organization.label,
content_id: content_id)
end
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/actions/katello/organization_test.rb
Expand Up @@ -72,7 +72,7 @@ class DestroyTest < TestBase

organization.expects(:label).returns("ACME_Corporation")
organization.expects(:validate_destroy).returns([])
organization.expects(:products).twice.returns([])
organization.expects(:products).returns([])
where_clause = mock
where_clause.expects(:where).returns([])
::Host.expects(:unscoped).returns(where_clause)
Expand Down