Sha256: 5d8c89a4bd7e12b95211c443bc3c92333da25e0e4056134afae3f93ef7bf1fba

Contents?: true

Size: 844 Bytes

Versions: 264

Compression:

Stored size: 844 Bytes

Contents

class Puppet::Pops::Evaluator::Collectors::CatalogCollector < Puppet::Pops::Evaluator::Collectors::AbstractCollector

  # Creates a CatalogCollector using the AbstractCollector's 
  # constructor to set the scope and overrides
  #
  # param [Puppet::CompilableResourceType] type the resource type to be collected
  # param [Proc] query the query which defines which resources to match
  def initialize(scope, type, query, overrides = nil)
    super(scope, overrides)

    @query = query

    @type = Puppet::Resource.new(type, 'whatever').type
  end

  # Collects virtual resources based off a collection in a manifest
  def collect
    t = @type
    q = @query

    scope.compiler.resources.find_all do |resource|
      resource.type == t && (q ?  q.call(resource) : true)
    end
  end

  def to_s
    "Catalog-Collector[#{@type}]"
  end
end

Version data entries

264 entries across 264 versions & 1 rubygems

Version Path
puppet-7.34.0 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.34.0-x86-mingw32 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.34.0-x64-mingw32 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.34.0-universal-darwin lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.33.0 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.33.0-x86-mingw32 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.33.0-x64-mingw32 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.33.0-universal-darwin lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.32.1 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.32.1-x86-mingw32 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.32.1-x64-mingw32 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.32.1-universal-darwin lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.31.0 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.31.0-x86-mingw32 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.31.0-x64-mingw32 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.31.0-universal-darwin lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.30.0 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.30.0-x86-mingw32 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.30.0-x64-mingw32 lib/puppet/pops/evaluator/collectors/catalog_collector.rb
puppet-7.30.0-universal-darwin lib/puppet/pops/evaluator/collectors/catalog_collector.rb