Puppet Function: postgresql_password

Defined in:
lib/puppet/parser/functions/postgresql_password.rb
Function type:
Ruby 3.x API

Overview

postgresql_password()Any

This function returns the postgresql password hash from the clear text username / password

Returns:

  • (Any)

    Returns the postgresql password hash from the clear text username / password.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/puppet/parser/functions/postgresql_password.rb', line 6

newfunction(:postgresql_password, type: :rvalue, doc: <<-EOS
  This function returns the postgresql password hash from the clear text username / password
  @return Returns the postgresql password hash from the clear text username / password.
  EOS
           ) do |args|

  if args.size != 2
    raise(Puppet::ParseError, 'postgresql_password(): Wrong number of arguments ' \
      "given (#{args.size} for 2)")
  end

  username = args[0]
  password = args[1]

  'md5' + Digest::MD5.hexdigest(password.to_s + username.to_s)
end