Handling secrets.tdb in upgrade.py for classicupgrade

Jelmer Vernooij jelmer at samba.org
Mon Jul 16 05:00:09 MDT 2012


On Mon, Jul 16, 2012 at 08:00:50PM +1000, Andrew Bartlett wrote:
> From f2f0578183ed8525e4189d0df322a7b5385aa7f0 Mon Sep 17 00:00:00 2001
> From: Andrew Bartlett <abartlet at samba.org>
> Date: Mon, 16 Jul 2012 19:43:15 +1000
> Subject: [PATCH] pytdb: Check if the database is closed before we touch it

> If .close() has already been called, we have to play dead - the
> self->ctx is just not valid any more, as we have been shut down to
> allow some other part of Samba to open the tdb.

Thanks for that patch, it looks good to me.

> diff --git a/lib/tdb/python/tests/simple.py b/lib/tdb/python/tests/simple.py
> index c37ef83..7e295a8 100644
> --- a/lib/tdb/python/tests/simple.py
> +++ b/lib/tdb/python/tests/simple.py
> @@ -33,6 +33,11 @@ class CloseTdbTests(TestCase):
>          self.tdb.close()
>          self.tdb.close()

> +        # Check that further operations do not crash python
> +        self.assertRaises(RuntimeError, lambda: self.tdb.transaction_start())

Note that this can be written as just:

> +        self.assertRaises(RuntimeError, self.tdb.transaction_start)

Cheers,

Jelmer


More information about the samba-technical mailing list