File: mongodb_password.rb

package info (click to toggle)
puppet-module-puppetlabs-mongodb 0.7.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 304 kB
  • sloc: ruby: 982; sh: 10; makefile: 4
file content (14 lines) | stat: -rw-r--r-- 415 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'digest/md5'

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

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

    Digest::MD5.hexdigest("#{args[0]}:mongo:#{args[1]}")
  end
end