puppetlabs/puppet · error · ArgumentError
Could not get dn from ldap entry
Error message
Could not get dn from ldap entry
What it means
ArgumentError raised by Puppet::Util::Ldap::Manager#entry2provider when converting a raw LDAP entry hash that lacks the 'dn' (distinguished name) key. It indicates the entry returned from the LDAP search is malformed or not a real entry, so it cannot be translated into a provider-style resource hash.
Solutions
- Inspect the LDAP entry returned by the search to see why it has no dn
- Verify the LDAP base and search filter are not returning container/partial entries
- Check the ldapsearch result with the same filter used by the provider
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/puppet/util/ldap/manager.rb:94 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/7c231190cd6aa641.
Report an issue: GitHub.
Appendix: source
Thrown at lib/puppet/util/ldap/manager.rb:94
end
nil
end
# Convert the name to a dn, then pass the args along to
# our connection.
def delete(name)
connect { |connection| connection.delete dn(name) }
end
# Calculate the dn for a given resource.
def dn(name)
["#{rdn}=#{name}", base].join(",")
end
# Convert an ldap-style entry hash to a provider-style hash.
def entry2provider(entry)
# TRANSLATOR 'dn' refers to a 'distinguished name' in LDAP (Lightweight Directory Access Protocol) and they should not be translated
raise ArgumentError, _("Could not get dn from ldap entry") unless entry["dn"]
# DN is always a single-entry array. Strip off the bits before the
# first comma, then the bits after the remaining equal sign. This is the
# name.
name = entry["dn"].dup.pop.split(",").shift.split("=").pop
result = { :name => name }
@ldap2puppet.each do |ldap, puppet|
result[puppet] = entry[ldap.to_s] || :absent
end
result
end
# Create our normal search filter.
def filter
(objectclasses.length == 1 ? "objectclass=#{objectclasses[0]}" : "(&(objectclass=" + objectclasses.join(")(objectclass=") + "))")View on GitHub (pinned to e227c27540)