source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 8 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

File size: 758 bytes
Line 
1#
2# is_function_available.rb
3#
4
5module Puppet::Parser::Functions
6 newfunction(:is_function_available, :type => :rvalue, :doc => <<-EOS
7This function accepts a string as an argument, determines whether the
8Puppet runtime has access to a function by that name. It returns a
9true if the function exists, false if not.
10 EOS
11 ) do |arguments|
12
13 if (arguments.size != 1) then
14 raise(Puppet::ParseError, "is_function_available?(): Wrong number of arguments "+
15 "given #{arguments.size} for 1")
16 end
17
18 # Only allow String types
19 return false unless arguments[0].is_a?(String)
20
21 function = Puppet::Parser::Functions.function(arguments[0].to_sym)
22 function.is_a?(String) and not function.empty?
23 end
24end
25
26# vim: set ts=2 sw=2 et :
Note: See TracBrowser for help on using the repository browser.