Sha256: bbae4f63b2d5cab849fd6e23b5473e0761c931934297c2f1816d4e6841a34dcb

Contents?: true

Size: 484 Bytes

Versions: 14

Compression:

Stored size: 484 Bytes

Contents

# hash a string as mysql's "PASSWORD()" function would do it
require 'digest/sha1'

module Puppet::Parser::Functions
  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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
freighthop-0.6.1 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.6.0 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.5.2 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.5.1 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.5.0 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.4.1 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.4.0 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.3.3 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.3.2 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.3.1 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.3.0 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.2.1 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.2.0 modules/mysql/lib/puppet/parser/functions/mysql_password.rb
freighthop-0.1.0 modules/mysql/lib/puppet/parser/functions/mysql_password.rb