diff --git a/util/lib/puppet/parser/functions/to_array.rb b/util/lib/puppet/parser/functions/to_array.rb new file mode 100644 index 0000000..6b10b25 --- /dev/null +++ b/util/lib/puppet/parser/functions/to_array.rb @@ -0,0 +1,13 @@ +module Puppet::Parser::Functions + newfunction(:to_array, :type => :rvalue) do |args| + if args.length != 1 + raise Puppet::ParseError, ("to_array(): wrong number of arguments (#{args.length}; must be 1)") + end + if args[0].is_a?(Array) then + args[0] + else + [ args[0] ] + end + end +end +