
Monachus
By: a guest on Feb 8th, 2010 | syntax:
None | size: 0.81 KB | hits: 96 | expires: Never
*** OLD WAY ***
node basenode {
include global::test
}
node node1 inherits basenode {
$mta = "postfix"
include global::test2
}
class global::test {
notice("$mta: ${mta}") ## $mta is unset
}
class global::test2 {
notice("$mta: ${mta}") ## $mta == 'postfix'
}
*** NEW WAY ***
node basenode {
# ONLY USED TO SET DEFAULT VARIABLES
$mta = "exim4"
}
node node1 inherits basenode {
$mta = "postfix"
include global::base
include global::test2
}
class global::base {
# USED TO INCLUDE CLASSES _AFTER_ VARIABLES/TAGS HAVE BEEN SET FOR NODES
include global::test
}
class global::test {
notice("$mta: ${mta}") ## $mta == 'postfix' for node1, and 'exim4' for anything else
}
class global::test2 {
notice("$mta: ${mta}") ## $mta == 'postfix'
}