Skip to content

Sorting of included schemas results in bad configurationΒ #125

@atombaby

Description

@atombaby

πŸ—£οΈ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

πŸ‘» Brief Description

Sorting of schemas results in missing attributes

πŸ₯ž Cookbook version

6.0.3

πŸ‘©β€πŸ³ Chef-Infra Version

17.10.3

🎩 Platform details

Ubuntu Bionic 18.04

Steps To Reproduce

  • add ldap-autofs to list of packages installed by cookbook
  • create list of schemas containing autofs.schema, ex:
node.default['openldap']['schemas'] = %w(
 core.schema
 cosine.schema
 inetorgperson.schema
 nis.schema
 autofs.schema
)
  • note that "autofs" is last as it depends on schema attributes from core (and maybe nis?)
  • converging will fail- the slapd service will not start.
  • systemctl status slapd doesn't contain useful messages- slaptest does:
vagrant@default-ubuntu-1804:~$ sudo slaptest -f /etc/ldap/slapd.conf -v
6303e2b4 /etc/ldap/schema/autofs.schema: line 26 objectclass: AttributeType not found: "ou"
slaptest: bad configuration file!

πŸš“ Expected behavior

A running slapd service with the autofs schema loaded.

I would expect that the ordering of the schema names in the attribute node[openldap][schemas] would be honored in the generated slapd configuration file.

βž• Additional context

When slapd processes the config file, each include line is processed in order (see include in the "Global Configuration Options" of the slapd.conf manpage). When sorted lexically, the schema for autofs is loaded first, but slapd doesn't have a definition for ou (available in the core schema) so fails.

This seems to occur in the template generating slapd.conf at line 22

I believe- given the algorithm for loading include files- that it's improper to sort this lexically and that the ordering of the array should be maintained in the output of this template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingHelp WantedAssistance is required to resolve this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions