On Fri, Jun 19, 2015 at 09:38:01AM +0200, Martin Kosek wrote:
> On 06/19/2015 09:28 AM, Fraser Tweedale wrote:
> > The attached patches fix upgrade issues when pki is also updated
> > from pre 10.2.4.
> > 
> > pki dependency is bumped to 10.2.5 - the official builds should be
> > done Friday (US time) but it is available from my copr[1].  If
> > someone wants to add to official freeipa COPR in meantime the SRPM
> > is here[2].
> > 
> > [1] https://copr.fedoraproject.org/coprs/ftweedal/freeipa/
> > [2] https://ftweedal.fedorapeople.org/pki-core-10.2.5-0.2.fc21.src.rpm
> > 
> > Thanks,
> > Fraser
> > 
> 
> This may work, it would be of course cleaner to do this via context manager, 
> in
> lines with:
> 
> @contextmanager
> def ldap_connect_autobind():
>     if not api.Backend.ldap2.isconnected():
>         api.Backend.ldap2.connect(autobind=True)
>     try:
>         yield
>     finally:
>         if api.Backend.ldap2.isconnected():
>             api.Backend.ldap2.disconnect()
> 
> ...
> 
>    try:
>        with ldap_connect_autobind():
>           # do API stuff
>    except PublicError, e:
>        ...
> 
> 
> as that would also unbind it if exception is raised for example.

Unless you or others feel strongly about this, let us do it as a
cleanup later, as there are several places in upgrade.py that do
this sort of thing.

Alternatively (or in addition) we need to make ldap2 be able to
attempt to reconnect on failure, as Simo (I think it was Simo)
suggested recently in another thread.

Cheers,
Fraser

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to