45055d324c
Renamed a few files and made some tweaks to try to get database_grant, database_user, and database types into a state where they work very similarly to the ones in the mysql module. Also introduced a "postgresql_password" function that can be used to generate an md5 password hash for a postgres user.
18 lines
541 B
Ruby
18 lines
541 B
Ruby
# hash a string as mysql's "PASSWORD()" function would do it
|
|
require 'digest/md5'
|
|
|
|
module Puppet::Parser::Functions
|
|
newfunction(:postgresql_password, :type => :rvalue, :doc => <<-EOS
|
|
Returns the postgresql password hash from the clear text username / password.
|
|
EOS
|
|
) do |args|
|
|
|
|
raise(Puppet::ParseError, "postgresql_password(): Wrong number of arguments " +
|
|
"given (#{args.size} for 2)") if args.size != 2
|
|
|
|
username = args[0]
|
|
password = args[1]
|
|
|
|
'md5' + Digest::MD5.hexdigest(password + username)
|
|
end
|
|
end
|