Sha256: a328d8f080bdc0aa154faad7c028b61d6b439b4304f0d0b22b09ff7d66769605
Contents?: true
Size: 925 Bytes
Versions: 1
Compression:
Stored size: 925 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) hostnames = hostname_rules_relation.keys.map{|h| h.downcase} hostnames.map! { |hname| hname.split('.').first } if Setting[:use_shortname_for_vms] { :conditions => (hostnames.empty? ? ' 0 = 1' : " hosts.name IN(#{hostnames.join(',')})") } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redhat_access-2.2.19 | app/models/redhat_access/concerns/host_managed_extensions.rb |