module-puppetlabs-mysql/lib/puppet/parser/functions/mysql_password.rb
2011-05-24 23:22:43 -07:00

9 lines
253 B
Ruby

# hash a string as mysql's "PASSWORD()" function would do it
require 'digest/sha1'
module Puppet::Parser::Functions
newfunction(:mysql_password, :type => :rvalue) do |args|
'*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(args[0])).upcase
end
end