module-mysql/lib/puppet/parser/functions/mysql_password.rb

10 lines
253 B
Ruby
Raw Normal View History

# 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