On Tue, Jan 11, 2011 at 07:06:59AM -0800, luke.bigum wrote:
> Hi all,
> 
> A question for those familiar with the internal Puppet APIs: is it
> possible to access the name and type of the Puppet resource/define
> that "called" a template from within that template? There was talk on
> the list a year ago that mentions "scope.compiler.catalog.vertices",
> but this is a list of all Puppet resources where I just want the one
> 'current' one, or even better, the ability to determine the parent
> resource/define of this resource/define (and up and up the chain).
> 
> It goes against information hiding principles, but it might be nice to
> say "this bit of this file was generated by this Puppet resource".
> 
> Thanks,
> 
> -Luke

This was mostly done by try and error since I dont know what you can
access through scope.* and what they mean but it worked in a short test:

# This file was generated by puppet
#
# Template Sourcefile: <%= file %>
# Puppetmanifest     : <%= scope.source.file %>
# Class/Define       : <%= scope.resource.path %>

-Stefan

Attachment: pgpxdma8mrS80.pgp
Description: PGP signature

Reply via email to