Skip to content

Commit

Permalink
Removed from Content Facet also
Browse files Browse the repository at this point in the history
  • Loading branch information
parthaa committed Sep 11, 2024
1 parent c877d96 commit 324dda8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
7 changes: 0 additions & 7 deletions app/models/katello/host/content_facet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,6 @@ def self.in_content_view_version_environments(version_environments)
relation.where(queries.join(" OR "))
end

def self.in_content_views_and_environments(content_views: nil, lifecycle_environments: nil)
relation = self.joins(:content_view_environment_content_facets => :content_view_environment)
relation = relation.where("#{::Katello::ContentViewEnvironment.table_name}.content_view_id" => content_views) if content_views
relation = relation.where("#{::Katello::ContentViewEnvironment.table_name}.environment_id" => lifecycle_environments) if lifecycle_environments
relation
end

def self.with_non_installable_errata(errata, hosts = nil)
content_facets = Katello::Host::ContentFacet.select(:id).where(:host_id => hosts)
reachable_repos = ::Katello::ContentFacetRepository.where(content_facet_id: content_facets).distinct.pluck(:repository_id)
Expand Down
4 changes: 1 addition & 3 deletions test/models/content_view_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,7 @@ def test_unique_environments
end

def test_check_remove_from_environment!
facets = ::Katello::Host::ContentFacet.in_content_views_and_environments(
lifecycle_environments: [@dev]
)
facets = ::Katello::Host::ContentFacet.with_environments(@dev)
host_ids = facets.joins(:host).select('hosts.id').pluck('hosts.id')
facets.each do |facet|
facet&.host&.subscription_facet&.destroy
Expand Down

0 comments on commit 324dda8

Please sign in to comment.