Sha256: 04d3d832b87ba8ee3548f122896e41d0d7f7d44da7d5298e2b3f7535f771556e

Contents?: true

Size: 783 Bytes

Versions: 19

Compression:

Stored size: 783 Bytes

Contents

require 'puppet/resource/type'
require 'puppet/indirector/code'
require 'puppet/indirector/resource_type'

class Puppet::Indirector::ResourceType::Parser < Puppet::Indirector::Code
  desc "Return the data-form of a resource type."

  def find(request)
    krt = request.environment.known_resource_types

    # This is a bit ugly.
    [:hostclass, :definition, :node].each do |type|
      if r = krt.send(type, request.key)
        return r
      end
    end
    nil
  end

  def search(request)
    raise ArgumentError, "Only '*' is acceptable as a search request" unless request.key == "*"
    krt = request.environment.known_resource_types
    result = [krt.hostclasses.values, krt.definitions.values, krt.nodes.values].flatten
    return nil if result.empty?
    result
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
puppet-2.6.18 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.17 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.16 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.15 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.14 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.13 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.12 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.11 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.10 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.9 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.8 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.7 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.6 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.5 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.4 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.3 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.2 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.1 lib/puppet/indirector/resource_type/parser.rb
puppet-2.6.0 lib/puppet/indirector/resource_type/parser.rb