mirror of
https://github.com/philippdieter/puppet-ldapquery.git
synced 2025-10-13 20:56:55 +00:00
Merge pull request #4 from xaque208/debug
Improve debugging, add timing information
This commit is contained in:
commit
e6fc47429a
@ -59,7 +59,6 @@ module PuppetX
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
Puppet.debug(conf)
|
|
||||||
return conf
|
return conf
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -73,8 +72,7 @@ module PuppetX
|
|||||||
|
|
||||||
conf = self.get_config()
|
conf = self.get_config()
|
||||||
|
|
||||||
Puppet.debug("Searching ldap base #{base} using #{@filter} for #{@attributes}")
|
start_time = Time.now
|
||||||
|
|
||||||
ldap = Net::LDAP.new(conf)
|
ldap = Net::LDAP.new(conf)
|
||||||
ldapfilter = Net::LDAP::Filter.construct(@filter)
|
ldapfilter = Net::LDAP::Filter.construct(@filter)
|
||||||
|
|
||||||
@ -87,9 +85,14 @@ module PuppetX
|
|||||||
:time => 10) do |entry|
|
:time => 10) do |entry|
|
||||||
entries << entry
|
entries << entry
|
||||||
end
|
end
|
||||||
Puppet.debug(entries)
|
end_time = Time.now
|
||||||
|
time_delta = sprintf('%.3f', end_time - start_time)
|
||||||
|
|
||||||
|
Puppet.debug("Searching #{@base} for #{@attributes} using #{@filter} took #{time_delta} seconds")
|
||||||
return entries
|
return entries
|
||||||
rescue
|
rescue Exception => e
|
||||||
|
Puppet.debug('There was an error searching LDAP #{e.message}')
|
||||||
|
Puppet.debug('Returning empty array')
|
||||||
return []
|
return []
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user