mirror of
https://github.com/philippdieter/puppet-ldapquery.git
synced 2025-10-13 12:55:48 +00:00
20 lines
464 B
Ruby
20 lines
464 B
Ruby
require 'puppet_x/ldapquery'
|
|
|
|
begin
|
|
require 'net/ldap'
|
|
rescue
|
|
Puppet.warn("Missing net/ldap gem required for ldapquery() function")
|
|
end
|
|
|
|
Puppet::Parser::Functions.newfunction(:ldapquery,
|
|
:type => :rvalue) do |args|
|
|
|
|
if args.size > 3
|
|
raise Puppet::ParseError, "Too many arguments received in ldapquery()"
|
|
end
|
|
|
|
filter, attributes, base = args
|
|
|
|
return PuppetX::LDAPquery.new(filter, attributes, base).results
|
|
end
|