18 Commits

Author SHA1 Message Date
Romain Tartière
81f72f5a83
Rename Net::LDAP::LdapError to Net::LDAP::Error
The net-ldap gem deprecated `Net::LDAP::LdapError` and renamed it to
`Net::LDAP::Error` starting with version 0.11 (released on Jan 21st,
2015).  Version 0.17 (released on Nov 29th, 2020) removed the deprecaded
`Net::LDAP::LdapError` class.

Update the module to use the new class and unbreak the module when using
a recent version of net-ldap.
2023-02-16 13:45:24 -10:00
Arjen Zonneveld
d13aec89dd Do explicit string conversion on values too
`to_s` the values too (like the attribute in line 129). This prevents the
copious logging of lines like

```
 [puppetserver] Puppet Ssh_authorized_key[arjen-ssh-rsa]['user']['key']['type'] contains a Net::BER::BerIdentifiedString value. It will be converted to the String 'ssh-rsa'
```

for each and every piece of data that gets used from the `ldapquery` results.
2022-10-06 12:29:48 +02:00
Tim Meusel
d3d643b1b2
rubocop: autofix 2022-03-11 23:24:02 +01:00
Trey Dockendorf
8d30438431
Allow ldapserver to be passed as argument
Put options for ldapquery into opts argument
2021-06-16 12:08:51 -04:00
Victor Cabezas
5669fde765 Emit a debug message with ca_file behavior 2020-04-20 10:33:03 +02:00
Victor Cabezas
d42bbd1c9b Remove setting 2020-04-16 18:34:14 +02:00
Victor Cabezas
38e4b25e29 Check for CA file existence 2020-04-16 18:19:37 +02:00
Zach Leslie
488bda0f7f Please rubocop 2018-02-10 13:22:12 -08:00
Zach Leslie
35b795632b Improve jenkins build and potential to publish 2018-02-08 21:05:31 -08:00
Zach Leslie
7dec36fc05 Improve scope error 2017-03-10 20:13:22 -08:00
Zach Leslie
5e4e0671ef modulesync 2017-02-07 2017-02-20 14:00:46 -08:00
Zach Leslie
1a7a4894b1 Add support for scoped queries
This work adds support for setting the scope of a given query.  This
allows retrieval of a specific objects, or searching at a specific level
of the tree for the desired results.
2016-05-16 13:18:18 -07:00
Zach Leslie
bf64a51a42 Always return an array for the values
Previously, its impossible to know if the results you are working with
in the puppet manifest are in string or array form without counting
them.  This work ensures that an array is always returned, even if there
is only one item returned.

This is useful in situations where an attribute is commonly both
multi-valued and single-valued to avoid complext manifest code.
2016-03-12 18:58:11 -08:00
Zach Leslie
da1af3a535 Add additional information in the search debug
Adds information about the number of results returned for the given
search.
2015-11-10 21:47:26 +00:00
Eric Zounes
b133f80a91 Return boolean false if the LDAP query function raises an exception. 2015-09-11 10:25:25 -07:00
Zach Leslie
9969f16a60 Increase granularity 2015-08-20 10:36:57 -07:00
Zach Leslie
a3ce58dc85 Improve debugging, add timing information
Ldap has the potential to slow down compiles if a search takes too long.
Here we add timing information to the debug output, so that in case of
question, we can at least have a method of determining the time a given
search took.
2015-08-20 10:36:57 -07:00
Zach Leslie
cb15ae8e70 Rewrite for testability
Testing the methods inside of the function is a complete pain.  This
moves the code out to use the PuppetX pattern and adds some basic unit
tests that validate the logic.
2015-05-20 12:55:18 -07:00