Created
April 25, 2012 18:48
-
-
Save richardc/2492158 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/md5' | |
module Puppet::Parser::Functions | |
newfunction(:md5_splay, :type => :rvalue) do |args| | |
raise(Puppet::ParseError, "md5_splay(): Wrong number of arguments " + | |
"given (#{args.size} for 2)") if args.size != 2 | |
value = args[0] | |
modulo = args[1].to_i | |
return Digest::MD5.hexdigest(value).hex % modulo | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment