Suppose, the following Puppet code:
define apache::base($pkgver = '2.4.10') {
$apache_ver = $pkgver
...
}
define apache::vhost($instance) {
...
$apache_ver = getvar(......)
}
apache::base{ "static-files":}
apache::base{ "dynamic": pkgver => '2.4.8' }
apache::vhost{ "static.example.com": instance => "static-files"}
How can the code in apache::vhost
refer to $pkgver
(parameter) or $apache_ver
(variable) in the corresponding apache::base
?
Our stdlib is too old (and our Puppet is still 2.7.x) and does not have getparam()
. getvar()
ought to be able to do it -- but how? What is the full name of the variable in this case?
I tried getvar("apache::base[$instance]::apache_ver")
and getvar("apache::base::$instance::apache_ver")
to no avail -- getvar returns an empty string... What's the right method?