From 81f72f5a83e5862cf28acbdc17cfc870105db90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Thu, 16 Feb 2023 13:45:24 -1000 Subject: [PATCH 1/2] 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. --- lib/puppet_x/ldapquery.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet_x/ldapquery.rb b/lib/puppet_x/ldapquery.rb index 6c31a37..e553cd1 100644 --- a/lib/puppet_x/ldapquery.rb +++ b/lib/puppet_x/ldapquery.rb @@ -114,7 +114,7 @@ module PuppetX Puppet.debug("ldapquery(): Searching #{@base} for #{@attributes} using #{@filter} took #{time_delta} seconds and returned #{entries.length} results") entries - rescue Net::LDAP::LdapError => e + rescue Net::LDAP::Error => e Puppet.debug("There was an error searching LDAP #{e.message}") Puppet.debug('Returning false') false From 373a22269275e4bff17e800e0a985d96b17cb931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Thu, 16 Feb 2023 13:54:43 -1000 Subject: [PATCH 2/2] Adjust the README Indicate the minimum version required for net-ldap. While here, remove references to versions of Ruby which have been gone long ago! --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a3c13a..62cac0e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A Puppet function to query LDAP. ## Dependencies -The Ruby `net-ldap` gem is required to communicate with LDAP. The current version of net-ldap requires ruby 2.0.0. If you run your master with puppetserver you have to use version 0.12.1 which is the last version compatible with ruby 1.9 which is used by puppetserver. To install this use the following command: `puppetserver gem install net-ldap -v 0.12.1` +The Ruby `net-ldap` gem is required to communicate with LDAP. To install this use the following command: `puppetserver gem install net-ldap`. Version 0.11.0 or newer of `net-ldap` is required. In some environments, when `ldapquery()` is used on Puppet Server, an error like the following may appear.