[Freeipa-devel] [PATCH] Don't load the LDAP schema during startup
Jan Zelený
jzeleny at redhat.com
Wed Feb 23 10:16:38 UTC 2011
Jan Zelený <jzeleny at redhat.com> wrote:
> Rob Crittenden <rcritten at redhat.com> wrote:
> > Jan Zelený wrote:
> > > Rob Crittenden<rcritten at redhat.com> wrote:
> > >> Jan Zelený wrote:
> > >>> Loading of the schema is now performed in the first request that
> > >>> requires it.
> > >>>
> > >>> https://fedorahosted.org/freeipa/ticket/583
> > >>>
> > >>> Jan
> > >>
> > >> We still need to enforce that we get the schema, some low-level
> > >> functions depend on it. Also, if the UI doesn't get its aciattrs
> > >> (which are derived from the schema) then nothing will be editable.
> > >
> > >> I'm getting this backtrace if I force no schema by disabling
get_schema:
> > > Ok, I'm sending new version, it should handle these exceptions better
> > > and the operation should fail if it needs the schema and the schema is
> > > not available for some reason.
> >
> > This breaks the XML-RPC server. I fixed one problem:
> > --- a/ipaserver/plugins/ldap2.py
> > +++ b/ipaserver/plugins/ldap2.py
> >
> > @@ -253,9 +253,10 @@ class ldap2(CrudBackend, Encoder):
> > def get_syntax(self, attr, value):
> > if not self.schema:
> > - self.schema = get_schema(self.ldap_uri, self.conn)
> > - if not self.schema:
> > + schema = get_schema(self.ldap_uri, self.conn)
> >
> > + if not schema:
> > return None
> >
> > + object.__setattr__(self, 'schema', schema)
> >
> > obj = self.schema.get_obj(_ldap.schema.AttributeType, attr)
> >
> > if obj is not None:
> > return obj.syntax
> >
> > But simply things like get_entry() return an InternalError now. I'm not
> > sure where you were going by adding this.
> >
> > rob
>
> Ok, no problem. It's possible that I simply did a mistake thinking I can do
> something in Python what is not really possible.
>
> About that InternalError: I think raising InternalError when we cannot load
> the schema to do the decoding is the right thing to do. Do you have a
> better solution? I thought about returning empty result, but that would
> mean we have to check the result in every funtction that is calling them
> and raising InternalError there.
I'm sending updated patch. I modified the get_syntax() as you suggested and I
slightly modified raising that InternalError - currently it isn't raised when
results from get_entry() are not required by calling method. Currently I'm
running some tests, preliminary results looked ok.
--
Thank you
Jan Zeleny
Red Hat Software Engineer
Brno, Czech Republic
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jzeleny-freeipa-0041-3-Don-t-load-the-LDAP-schema-during-startup.patch
Type: text/x-patch
Size: 17376 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20110223/799a39d6/attachment.bin>
More information about the Freeipa-devel
mailing list