mirror of
https://github.com/philippdieter/puppet-ldapquery.git
synced 2025-10-13 12:55:48 +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,
|
Puppet::Parser::Functions.newfunction(:ldapquery,
|
||||||
type: :rvalue) do |args|
|
type: :rvalue) do |args|
|
||||||
|
|
||||||
if args.size > 4
|
if args.size > 3
|
||||||
raise Puppet::ParseError, 'Too many arguments received in ldapquery()'
|
raise Puppet::ParseError, 'Too many arguments received in ldapquery()'
|
||||||
end
|
end
|
||||||
|
|
||||||
filter, attributes, base, scope = args
|
filter, attributes, opts = args
|
||||||
|
|
||||||
attributes ||= []
|
attributes ||= []
|
||||||
base ||= Puppet[:ldapbase]
|
opts ||= {}
|
||||||
scope ||= 'sub'
|
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
|
end
|
||||||
|
@ -9,11 +9,13 @@ module PuppetX
|
|||||||
filter,
|
filter,
|
||||||
attributes = [],
|
attributes = [],
|
||||||
base = Puppet[:ldapbase],
|
base = Puppet[:ldapbase],
|
||||||
scope = 'sub'
|
scope = 'sub',
|
||||||
|
server = Puppet[:ldapserver]
|
||||||
)
|
)
|
||||||
@filter = filter
|
@filter = filter
|
||||||
@attributes = attributes
|
@attributes = attributes
|
||||||
@base = base
|
@base = base
|
||||||
|
@host = server
|
||||||
|
|
||||||
return unless scope
|
return unless scope
|
||||||
|
|
||||||
@ -41,7 +43,6 @@ module PuppetX
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
host = Puppet[:ldapserver]
|
|
||||||
port = Puppet[:ldapport]
|
port = Puppet[:ldapport]
|
||||||
|
|
||||||
if Puppet[:ldapuser] && Puppet[:ldappassword]
|
if Puppet[:ldapuser] && Puppet[:ldappassword]
|
||||||
@ -53,7 +54,7 @@ module PuppetX
|
|||||||
ca_file = "#{Puppet[:confdir]}/ldap_ca.pem"
|
ca_file = "#{Puppet[:confdir]}/ldap_ca.pem"
|
||||||
|
|
||||||
conf = {
|
conf = {
|
||||||
host: host,
|
host: @host,
|
||||||
port: port
|
port: port
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user