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 / passwordOverview
postgresql_password.rb —- original file header —-
@return Returns the postgresql password hash from the clear text username / password.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/puppet/functions/postgresql/postgresql_password.rb', line 20 Puppet::Functions.create_function(:'postgresql::postgresql_password') do # @param args # The original array of arguments. Port this to individually managed params # to get the full benefit of the modern function API. # # @return [Data type] # Describe what the function returns here # dispatch :default_impl do # Call the method named 'default_impl' when this is matched # Port this to match individual params for better type safety repeated_param 'Any', :args end def default_impl(*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 end |