Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / glob.rb
1 #
2 #  glob.rb
3 #
4 module Puppet::Parser::Functions
5   newfunction(:glob, :type => :rvalue, :doc => <<-'DOC'
6     Returns an Array of file entries of a directory or an Array of directories.
7     Uses same patterns as Dir#glob
8     DOC
9              ) do |arguments|
10
11     unless arguments.size == 1
12       raise(Puppet::ParseError, 'glob(): Wrong number of arguments given ' \
13         "(#{arguments.size} for 1)")
14     end
15
16     pattern = arguments[0]
17
18     unless pattern.is_a?(String) || pattern.is_a?(Array)
19       raise(Puppet::ParseError, 'glob(): Requires either array or string ' \
20         'to work')
21     end
22
23     Dir.glob(pattern)
24   end
25 end