Sha256: 9f428651f37b0ffdf79b9a47822cb61b752a264c0b1ad16b682096f006b89b75

Contents?: true

Size: 815 Bytes

Versions: 13

Compression:

Stored size: 815 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).pluck(:id)
          { :conditions => " hosts.id IN(#{host_ids.join(',')})" }
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
redhat_access-2.2.14 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.13 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.12 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.11 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.10 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.9 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.8 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.7 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.6 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.5 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.4 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.3 app/models/redhat_access/concerns/host_managed_extensions.rb
redhat_access-2.2.2 app/models/redhat_access/concerns/host_managed_extensions.rb