# how to get the name of a defined resource inside itself?

Is there any way to find the actual name (i.e., not $name or $title) of a defined resource from inside its code?

# this file is in modules/mymodule/manifests/mydefine.pp
define mymodule::mydefine {
notice("this define is ${something}") }  ...and I want the notice to read "this define is mydefine" or "this define is mymodule::mydefine". edit retag close merge delete ## Comments AFAIK, there's only$module_name. This gives you “mymodule”. You primarily want the manifest name though (in this case “mydefine”). I'm afraid, there's no such variable. Workaround: You can define inside mydefine.pp a new variable \$self = 'mydefine' and use that instead.

( 2017-01-02 18:03:54 -0500 )edit