Class Puppet::Resource::Type
In: lib/puppet/resource/type.rb
Parent: Object

Methods

Included Modules

Puppet::Util::InlineDocs Puppet::Util::Warnings Puppet::Util::Errors

Constants

ResourceType = self
RESOURCE_SUPERTYPES = [:hostclass, :node, :definition]

Attributes

arguments  [R] 
behaves_like  [R] 
code  [RW] 
doc  [RW] 
file  [RW] 
line  [RW] 
module_name  [RW] 
namespace  [R] 
parent  [RW] 
resource_type_collection  [RW] 
ruby_code  [RW] 
type  [R] 

Public Class methods

Public Instance methods

Are we a child of the passed class? Do a recursive search up our parentage tree to figure it out.

Make an instance of the resource type, and place it in the catalog if it isn‘t in the catalog already. This is only possible for classes and nodes. No parameters are be supplied—if this is a parameterized class, then all parameters take on their default values.

Now evaluate the code associated with this class or definition.

This is only used for node names, and really only when the node name is a regexp.

Add code from a new instance to our code.

MQR TODO:

The change(s) introduced by the fix for 4270 are mostly silly & should be removed, though we didn‘t realize it at the time. If it can be established/ ensured that nodes never call parent_type and that resource_types are always (as they should be) members of exactly one resource_type_collection the following method could / should be replaced with:

def parent_type

  @parent_type ||= parent && (
    resource_type_collection.find_or_load([name],parent,type.to_sym) ||
    fail Puppet::ParseError, "Could not find parent resource type '#{parent}' of type #{type} in #{resource_type_collection.environment}"
  )

end

…and then the rest of the changes around passing in scope reverted.

Set any arguments passed by the resource as variables in the scope.

Create a new subscope in which to evaluate our code.

Check whether a given argument is valid.

[Validate]