[Puppet Users] Determining if hiera (or any function) is installed on a node

Geoff Davis
Tue, 17 Apr 2012 18:08:44 -0000

I''m doing some work on module development inside of a Vagrant VM of
CentOS 6.2. This VM has the community version of Puppet installed (2.7.13 I
think), but that doesn''t include Hiera by default.

My module is dependent on Nan Liu''s puppet-staging module, which
requires hiera. This puts me into the proverbial chicken and egg problem of not
having a puppet function but also not being able to install it with puppet,
since my manifests don''t compile due to the hiera function not being
available.

Right now, I''m doing a manual bootstrap of a new vagrant box with a
dedicated Puppet manifest that calls another one of Nan''s modules,
puppet-hiera, to install hiera on the Vagrant VM, but I''d rather use
the same manifest for both bootstrap and module testing. I don''t care
if it takes two passes to converge, I just don''t want a freshly booted
Vagrant box to complain because it can''t compile it''s
manifest.

Is there a relatively foolproof way to determine if Puppet has a function
available to it or not? Is there a "has_function" function available
in the Puppet DSL, or is there a check that I could roll into a fact that works
cross-platform and between Puppet Enterprise and Community?