Hi Eirik,
I think I understand what you want to do - set some sensible defaults, and just
get the most specific or unique parameters from Hiera.
This article by RIP helped me a lot to understand how to do that:
https://www.devco.net/archives/2015/12/16/iterating-in-puppet.php ' wildcard
and
On 8 Oct 2018, at 17:05, Henrik Lindberg wrote:
>
> On 2018-10-08 08:44, Eirik Øverby wrote:
>> Hi,
>> Sorry for hijacking this thread, but it caught my interest.
>> My scenario is that I'd like to re-use the title of an nginx server instance
>> in, say, the log file for that server instance.
On 2018-10-08 08:44, Eirik Øverby wrote:
Hi,
Sorry for hijacking this thread, but it caught my interest.
My scenario is that I'd like to re-use the title of an nginx server instance
in, say, the log file for that server instance. However, since I don't want to
touch the nginx module itself,
Hi,
Sorry for hijacking this thread, but it caught my interest.
My scenario is that I'd like to re-use the title of an nginx server instance
in, say, the log file for that server instance. However, since I don't want to
touch the nginx module itself, it seems I have to wrap its server class
I like Henrik’s solution better than mine.
I have been dealing with old versions of Puppet for too long.
> On Oct 7, 2018, at 9:47 PM, Jody Des Roches wrote:
>
> Thank you Dan and Henrik for taking the time to help.
> Henrik, your solution is what I am using in concert with common.yaml to add
Thank you Dan and Henrik for taking the time to help.
Henrik, your solution is what I am using in concert with common.yaml to add
a default to the base_dir value.
Mahalo!
-Jody
On Sun, Oct 7, 2018 at 5:35 AM Henrik Lindberg
wrote:
> If you are on a reasonably modern Puppet version you should
If you are on a reasonably modern Puppet version you should do it like this:
class myclass(
String $base_dir,
Optional[String] $conf_dir = "${base_dir}/conf"
) {
}
I tested it as well:
class myclass(
String $base_dir,
Optional[String] $conf_dir = "${base_dir}/conf"
) {
You need to do like this:
class myClass (
String $base_dir,
Optional[String] $conf_dir,
) {
if $myClass::conf_dir == undef {
$myClass::actual_conf_dir = "$myClass::base_dir/conf”
} else {
$myClass::actual_conf_dir = $myClass::conf_dir
}
… and then use
I'd like to set default values for parameters that will be passed to epp
templates. However, the default value is based on another parameter. I
understand that variables are immutable but this is a parameter that
shouldn't be touched unless it wasn't set.
Here is an example construct with a