Puppet Function: mysql_password

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

Overview

mysql_password()Any

Returns the mysql password hash from the clear text password.

Returns:

  • (Any)


5
6
7
8
9
10
11
12
13
14
15
# File 'lib/puppet/parser/functions/mysql_password.rb', line 5

newfunction(:mysql_password, :type => :rvalue, :doc => <<-EOS
  Returns the mysql password hash from the clear text password.
  EOS
) do |args|

  raise(Puppet::ParseError, 'mysql_password(): Wrong number of arguments ' +
    "given (#{args.size} for 1)") if args.size != 1

  return '' if args[0].empty?
  '*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(args[0])).upcase
end