Skip to content

Commit

Permalink
Revert "Fix querying for hosts using puppet class"
Browse files Browse the repository at this point in the history
This reverts commit 01ffd20.
  • Loading branch information
nadjaheitmann committed Nov 8, 2024
1 parent fb60485 commit 804ad3f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/models/concerns/foreman_puppet/extensions/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ def search_by_puppetclass(_key, operator, value)
conditions = sanitize_sql_for_conditions(["puppetclasses.name #{operator} ?", value_to_sql(operator, value)])
config_group_ids = ForemanPuppet::ConfigGroup.joins(:puppetclasses).where(conditions).pluck(:id)
host_ids = ::Host.authorized(:view_hosts).joins(puppet: :puppetclasses).where(conditions).distinct.pluck(:id)
host_ids += ForemanPuppet::HostPuppetFacet.joins(:host_config_groups)
.where(host_config_groups: { config_group_id: config_group_ids })
.pluck(:host_id)
host_ids += ForemanPuppet::HostConfigGroup
.where(host_type: 'ForemanPuppet::HostPuppetFacet')
.where(config_group_id: config_group_ids)
.pluck(:host_id)
hostgroup_ids = ::Hostgroup.unscoped.with_taxonomy_scope.joins(puppet: :puppetclasses).where(conditions).map(&:subtree_ids)
if config_group_ids.any?
hostgroup_cg_ids = ForemanPuppet::HostgroupPuppetFacet.joins(:host_config_groups)
Expand Down

0 comments on commit 804ad3f

Please sign in to comment.