Skip to content

Commit

Permalink
Fixes #37543 - CV promote during host deletion fails
Browse files Browse the repository at this point in the history
(cherry picked from commit 2d8fe20)
  • Loading branch information
ianballou authored and parthaa committed Jun 26, 2024
1 parent d9127aa commit e572511
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/katello/content_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ def update_host_statuses(environment)
).each do |facet|
facet.update_applicability_counts
facet.update_errata_status
rescue NoMethodError
Rails.logger.warn _('Errata statuses not updated for deleted content facet with UUID %s') % facet.uuid
end
end
end
Expand Down
16 changes: 16 additions & 0 deletions test/models/content_view_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,22 @@ def test_update_host_statuses
end
end

def test_update_host_statuses_host_deleted
other_location = taxonomies(:location2)
facet = katello_content_facets(:content_facet_two)
org = facet.host.organization
::Katello::Host::ContentFacet.any_instance.stubs(:host).returns(nil)
Rails.logger.expects(:warn).once

assert_nothing_raised do
Location.as_taxonomy(org, other_location) do
facet.content_view_environments.each do |cve|
cve.content_view.update_host_statuses(cve.lifecycle_environment)
end
end
end
end

def test_unpublishable?
default_content_view = ContentView.default.first
import_only_content_view = FactoryBot.create(:katello_content_view, :import_only)
Expand Down

0 comments on commit e572511

Please sign in to comment.