-
Notifications
You must be signed in to change notification settings - Fork 126
Add a custom schema to SlapdObject with a slapadd method? #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For the record, here is how I add custom schema now: class CustomSlapdObject(slapdtest.SlapdObject):
custom_schema_files = ("my_custom.schema",)
custom_schema_dir = "/path/to/somewhere"
def _ln_schema_files(self, *args, **kwargs):
super()._ln_schema_files(*args, **kwargs)
super()._ln_schema_files(self.custom_schema_files, self.custom_schema_dir)
def gen_config(self):
previous = self.openldap_schema_files
self.openldap_schema_files += self.custom_schema_files
config = super().gen_config()
self.openldap_schema_files = previous
return config |
That generally sounds reasonable. |
Well I suppose I would write a test for my usecase. That would be use |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Operating system: Archlinux
Python version: 3.8.5
python-ldap version: 3.3.0
I wrote a custom schema and I would like to write some tests using this schema.
I can manage to do this by copying or linking my schema files in
SlapdObject.SCHEMA_DIR
before the process is launched. However this is not convenient at all (see next comment).The
ldapadd
command cannot add schemas:However, the
slapadd
command could. I suggest to implement aSlapdObject.slapadd
method, similar toSlapdObject.ldapadd
. This would allow to callslapadd -l myschema.ldif -n0
(-n0
being an option, that could be used to add the schema in theconfig
database). This way, one could add a schema to theslapd
server test after it is started.If
ldapadd
seems too much, maybe we can just find a mechanism to simply add custom schemas by configuring or passing parameters toSlapdObject
?If you are ok with this, I can provide a patch.
What do you think?
The text was updated successfully, but these errors were encountered: