jms1
08/21/2025, 6:44 PM$module_name variable? so in a profile::base class, $module_name is profile, and (something) is profile::base ?helindbe
08/21/2025, 8:22 PMjms1
08/21/2025, 8:52 PM$name next week (i'm shutting down now and i'm out tomorrow), thanks for the pointershelindbe
08/22/2025, 9:18 AMcat namecheck.pp
class banana {
notice "class banana name = ${name}"
fruit { 'mango': }
sallad()
}
define fruit() {
notice $name
}
function sallad() {
notice "name in sallad function is ${name}"
}
include banana
henrik$ cat namecheck.pp
class banana {
notice "class banana name = ${name}"
fruit { 'mango': }
sallad()
}
define fruit() {
notice $name
}
function sallad() {
notice "name in sallad function is ${name}"
}
include banana
henrik$ puppet apply namecheck.pp
Notice: Scope(Class[Banana]): class banana name = banana
Notice: Scope(Class[main]): name in sallad function is main
Notice: Scope(Fruit[mango]): mango
The $name is always the name/title of the resource/class-body being evaluated. As you can see functions are typically in main scope. Functions in ruby can get the callers scope and resource associated with those scopes and also pass a scope to what it calls. this is used by functions like include().