Puppet Function: postgresql::postgresql_password

Defined in:
lib/puppet/functions/postgresql/postgresql_password.rb
Function type:
Ruby 4.x API

Summary

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

Overview

postgresql::postgresql_password(Variant[String[1],Integer] $username, Variant[String[1],Integer] $password)String

Parameters:

  • username (Variant[String[1],Integer])

    The clear text ‘username`

  • password (Variant[String[1],Integer])

    The clear text ‘password`

Returns:

  • (String)

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



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

Puppet::Functions.create_function(:'postgresql::postgresql_password') do
  # @param username
  #   The clear text `username`
  # @param password
  #   The clear text `password`
  #
  # @return [String]
  #   The postgresql password hash from the clear text username / password.
  dispatch :default_impl do
    param 'Variant[String[1],Integer]', :username
    param 'Variant[String[1],Integer]', :password
  end

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