Sha256: e8af118f9bc31fe163798cd06f6aef4c93fb4b879da0e34676b69cfd4a243900

Contents?: true

Size: 541 Bytes

Versions: 20

Compression:

Stored size: 541 Bytes

Contents

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

module Puppet::Parser::Functions
  newfunction(:postgresql_password, :type => :rvalue, :doc => <<-EOS
    Returns the postgresql password hash from the clear text username / password.
    EOS
  ) do |args|

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

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

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
freighthop-0.6.1 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.6.0 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.5.2 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.5.1 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.5.0 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.4.1 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.4.0 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.3.3 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.3.2 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.3.1 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.3.0 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.2.1 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.2.0 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.1.0 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.0.6 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.0.5 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.0.4 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.0.3 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.0.2 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb
freighthop-0.0.1 modules/postgresql/lib/puppet/parser/functions/postgresql_password.rb