mirror of
https://github.com/philippdieter/puppet-ldapquery.git
synced 2025-10-13 04:54:47 +00:00
Allow ldapserver to be passed as argument
Put options for ldapquery into opts argument
This commit is contained in:
parent
f9c350da5b
commit
8d30438431
@ -17,15 +17,17 @@ end
|
||||
Puppet::Parser::Functions.newfunction(:ldapquery,
|
||||
type: :rvalue) do |args|
|
||||
|
||||
if args.size > 4
|
||||
if args.size > 3
|
||||
raise Puppet::ParseError, 'Too many arguments received in ldapquery()'
|
||||
end
|
||||
|
||||
filter, attributes, base, scope = args
|
||||
filter, attributes, opts = args
|
||||
|
||||
attributes ||= []
|
||||
base ||= Puppet[:ldapbase]
|
||||
scope ||= 'sub'
|
||||
opts ||= {}
|
||||
base = opts['base'] || Puppet[:ldapbase]
|
||||
scope = opts['scope'] || 'sub'
|
||||
server = opts['server'] || Puppet[:ldapserver]
|
||||
|
||||
return PuppetX::LDAPquery.new(filter, attributes, base, scope).results
|
||||
return PuppetX::LDAPquery.new(filter, attributes, base, scope, server).results
|
||||
end
|
||||
|
@ -9,11 +9,13 @@ module PuppetX
|
||||
filter,
|
||||
attributes = [],
|
||||
base = Puppet[:ldapbase],
|
||||
scope = 'sub'
|
||||
scope = 'sub',
|
||||
server = Puppet[:ldapserver]
|
||||
)
|
||||
@filter = filter
|
||||
@attributes = attributes
|
||||
@base = base
|
||||
@host = server
|
||||
|
||||
return unless scope
|
||||
|
||||
@ -41,7 +43,6 @@ module PuppetX
|
||||
end
|
||||
end
|
||||
|
||||
host = Puppet[:ldapserver]
|
||||
port = Puppet[:ldapport]
|
||||
|
||||
if Puppet[:ldapuser] && Puppet[:ldappassword]
|
||||
@ -53,7 +54,7 @@ module PuppetX
|
||||
ca_file = "#{Puppet[:confdir]}/ldap_ca.pem"
|
||||
|
||||
conf = {
|
||||
host: host,
|
||||
host: @host,
|
||||
port: port
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user