Puppet lookup() default value

27 views
Skip to first unread message

Jonathan Gazeley

unread,
Dec 5, 2016, 8:06:58 AM12/5/16
to puppet...@googlegroups.com
In my old Puppet+Hiera install, there was a variable 'ilom' defined for
some nodes in my estate, but not all. I used to handle it like this:

$ilom = hiera('ilom', undef)

if ($ilom) {
$ilomnotes = "iLOM address: ${ilom}"
} else {
$ilomnotes = undef
}

@@nagios_host { $::fqdn:
...
notes => $ilomnotes,
...
}

The new lookup() function doesn't work in the same way. What's the
recommended way of referencing a variable that may or may not exist?

I'm still getting used to new Hiera as I'm building my replacement
server and I've got a lot of legacy baggage :(

Thanks,
Jonathan

--
Jonathan Gazeley
Senior Systems Administrator
IT Services
University of Bristol
Reply all
Reply to author
Forward
0 new messages