Method: Puppet::Indirector#indirects

Defined in:
lib/puppet/indirector.rb

#indirects(indirection, options = {}) ⇒ Object

Declare that the including class indirects its methods to this terminus. The terminus name must be the name of a Puppet default, not the value – if it’s the value, then it gets evaluated at parse time, which is before the user has had a chance to override it.

Raises:

  • (ArgumentError)


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/puppet/indirector.rb', line 39

def indirects(indirection, options = {})
  raise(ArgumentError, _("Already handling indirection for %{current}; cannot also handle %{next}") % { current: @indirection.name, next: indirection }) if @indirection

  # populate this class with the various new methods
  extend ClassMethods
  include Puppet::Indirector::Envelope
  include Puppet::Network::FormatSupport

  # record the indirected class name for documentation purposes
  options[:indirected_class] = name

  # instantiate the actual Terminus for that type and this name (:ldap, w/ args :node)
  # & hook the instantiated Terminus into this class (Node: @indirection = terminus)
  @indirection = Puppet::Indirector::Indirection.new(self, indirection, **options)
end