From 13545d781b257afe3c3a107a669851c38cdfefbd Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Mon, 28 Nov 2011 17:19:50 +1100 Subject: s4-samdb: seqence_number() operation must be in a transaction --- source4/scripting/python/samba/samdb.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 234a9b9df3..0ad6857cac 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -829,3 +829,17 @@ accountExpires: %u if sd: m["nTSecurityDescriptor"] = ndr_pack(sd) self.add(m) + + def sequence_number(self, seq_type): + """Returns the value of the sequence number according to the requested type + :param seq_type: type of sequence number + """ + self.transaction_start() + try: + seq = super(SamDB, self).sequence_number(seq_type) + except Exception: + self.transaction_cancel() + raise + else: + self.transaction_commit() + return seq -- cgit