Sha256: ab6c2fff4ab645cec9beaece8926640fedf2bb6e3c5d60c9008b2ee8bf31ee98
Contents?: true
Size: 835 Bytes
Versions: 5
Compression:
Stored size: 835 Bytes
Contents
module RedhatAccess module Concerns module HostManagedExtensions extend ActiveSupport::Concern included do scoped_search :on => :plan_id, :complete_enabled => false, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER, :ext_method => :search_by_plan_id end module ClassMethods def search_by_plan_id(key, operator, value) insights_plan_runner = ForemanAnsible::InsightsPlanRunner.new(Organization.current, value.to_i) hostname_rules_relation = insights_plan_runner.hostname_rules(insights_plan_runner.playbook) host_ids = Host::Managed.where(:name => hostname_rules_relation.keys.map{|h| h.downcase}).pluck(:id) { :conditions => " hosts.id IN(#{host_ids.join(',')})" } end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems